Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 dynamic SQL

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2002-11-18 : 03:19:41

Currently I have a SELECT statement that I put together with about 25 if else statements in my ASP code. I need to implement efficient paging, so I need to get this into a stored procedure.

Can I pass the dynamically created string to the stored procedure and just run that ?? Is this a horrible way of doing it ?? Speed is quite important. I have 2 order by clauses, for speed I guess I could have 2 seperate procedures. How would I pass a string to it if I can infact do this?

Any suggestions greatly appreciated.

Thanks alot

mike123

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-11-18 : 07:59:40
You can pass the string to a stored procedure.
Next you can use sp_ExecuteSQL to execute the string.

http://www.sqlteam.com/item.asp?ItemID=4599
http://www.sqlteam.com/item.asp?ItemID=4619

We might be able to help you optimize if you post your select statement, your table structure, some sample data and expected output.



Edited by - ValterBorges on 11/18/2002 08:02:27
Go to Top of Page
   

- Advertisement -