SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 6th, 2000, 07:53 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Stored Procedures ...When?

<i><b>Originally posted by : Tejal (Shah)</b></i><br /><br />Hi,<br /> I am working on a shopping mall site. I have used sequel queries in my asp. My queries have varying conditions. This query can have 1 to 20 conditions which means conditions are formed at run time. Hence , do you think stored procedures should be used in such a situation where the condition itself is not fixed.<br />If so, how to use it?<br />I know the advantages of stored procedure.<br />Please guide me<br /><br />Thanks,<br />Tejal

Reply With Quote
  #2  
Old July 21st, 2000, 05:58 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : tantulus (tantulus@my-deja.com)</b></i><br />This is something I am working on at the moment.<br />It seems for dynamically built SQL statements the best way to put them into a stored procedure is to use:<br /><br />CREATE PROCEDURE [proc_get_details]<br />@OrderBy char(10)<br />AS<br />begin<br />declare @sql varchar(100)<br />set @sql = 'SELECT Name FROM table1 order by ' + @OrderBy + 'asc ' exec( @sql )<br />end<br /> <br />This doesn't really take advantage of the compiled stored procedure. Cause it has reconstruct the statement every time. What I am trying to do is make it dynamic by passing a few varible in and then using the SQL IF statement to determine which SQL statement to use.<br /><br />Hope this helps,<br />Tantulus<br /><br /><br />------------<br />Tejal at 7/6/2000 5:53:58 AM<br /><br /><br />Hi,<br /> I am working on a shopping mall site. I have used sequel queries in my asp. My queries have varying conditions. This query can have 1 to 20 conditions which means conditions are formed at run time. Hence , do you think stored procedures should be used in such a situation where the condition itself is not fixed.<br />If so, how to use it?<br />I know the advantages of stored procedure.<br />Please guide me<br /><br />Thanks,<br />Tejal

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Stored Procedures ...When?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway