RE: Stored Procedures - Am I going insane?

2001-02-20 Thread Rich Wild
Philip, as Paul stated, often in SQL you'll have to resort to using cursors to perform operations on a recordset on a per row basis. If you can avoid them do, they really are costly in performance terms Quote from the Wrox Professional SQL Server 7 programming book by Robert Viera: "Cursors

Re: Stored Procedures - Am I going insane?

2001-02-20 Thread Paul Hastings
worse negative performance impact [but] Cursors are going to be the answer anytime a solution must be done on a row-by-row basis." you can often use a series of set operations against temp tables instead of server side cursors or just plain sql if you're joe celko (or maybe tom potts who

RE: Stored Procedures - Am I going insane? - Here's what I want to do

2001-02-20 Thread Philip Arnold - ASP
OK, here's a full description of what I want to accomplish and some background We are working for a client who does Conferences - each conference has a mini-site which has pages describing it and central "How to get there" type pages There is one core site which contains the general pages,

RE: Stored Procedures - Am I going insane? - Here's what I want to do

2001-02-20 Thread Philip Arnold - ASP
Oops, one thing to complicate matters - the primary key on the tables aren't Identities OK, here's a full description of what I want to accomplish and some background We are working for a client who does Conferences - each conference has a mini-site which has pages describing it and central

Re: Stored Procedures - Am I going insane?

2001-02-20 Thread Deanna L. Schneider
Paul said: sp_executesql will gain you something in terms of optimization, etc. but this isn't the kind of thing that ought to be in an sp (unless you're doing this for security or management reasons) Why not? I've been taught by our database folks that the more stuff we can move into the

RE: Stored Procedures - Am I going insane?

2001-02-20 Thread Todd Stanley
: Deanna L. Schneider [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 20, 2001 8:53 AM To: CF-Talk Subject: Re: Stored Procedures - Am I going insane? Paul said: sp_executesql will gain you something in terms of optimization, etc. but this isn't the kind of thing that ought to be in an sp (unless yo

Re: Stored Procedures - Am I going insane?

2001-02-20 Thread G
- Original Message - From: "Deanna L. Schneider" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 7:52 AM Subject: Re: Stored Procedures - Am I going insane? Paul said: sp_executesql will gain you something in terms

RE: Stored Procedures - Am I going insane?

2001-02-20 Thread Jeremy Allen
Dave medinets has some stored proc's that use dynamic table names. Props to him ;) Check this out.. it aint the prettiest code in the world but it is possible. http://medinets.onproject.com/ntm/ Jeremy Allen elliptIQ Inc. -Original Message- From: Philip Arnold - ASP [mailto:[EMAIL

Re: Stored Procedures - Am I going insane?

2001-02-20 Thread Paul Hastings
Why not? I've been taught by our database folks that the more stuff we can why not? sp's aren't really meant for dynamc sql. if i had two logic branches in an sp, these would become 2 separate sp. unless security/management were the main issues. move into the database, the better - that cf is

RE: Stored Procedures - Am I going insane?

2001-02-20 Thread Keith Thornburn
Consider the following situation: A complex query that is broken down to mutiple queries that require at least one temporary table. If these queries are called from a SP then the temporary table(s) exist only for the duration of that SP. The other way of course is to drop the temp table(s) at

RE: Stored Procedures - Am I going insane?

2001-02-19 Thread Dave Watts
Is it possible in a SQL Server Stored Procedure to have dynamic table names? I'm currently trying to; Create Procedure update_pages (@tablename varchar(255), @rowlist varchar(255)) as begin update [@tablename] inner join Central_Pages on [@tablename].ID=Central_Pages.ID

Re: Stored Procedures - Am I going insane?

2001-02-19 Thread Paul Hastings
While I'm on the SP subject - something I've never had to do inside one is loop over a select and do something on the result... is this possible? you do this with server-side cursors, which should be avoided if at all possible. what are you trying to do?

Re: Stored Procedures - Am I going insane?

2001-02-19 Thread Paul Hastings
Typically, when you're building SQL on the fly, you'll have to build a string, then use EXECUTE (in SQL 6.5) or sp_executesql (in SQL 7 or 2000) to execute the string. sp_executesql will gain you something in terms of optimization, etc. but this isn't the kind of thing that ought to be in an