Quote:
Originally Posted by Joseph James
Thanks for your replay,
That’s simple of course. But this will make the sql to be recompiled every time we execute it. So we may loose one of the main advantage of using a stored procedure.
Regards
|
That's one advantage of using procs, but there are others, like sending less data back and forth, security, all that great stuff. Your other choices are to just generate a dynamic query on the web server and send it to the database server, you could make a lot of optional parameters to your proc and then use a lot of "or x is null" statements in your where clause.
If you're using SQL Server 2005 you can write your stored procedures in VB or C#, but I wouldn't recommend it. I think SQL 2000 will cache ad hoc queries you throw at it, so "select * from table where id=4" becomes "select * from table where id=?" which is a lot like a stored procedure, except those are compiled when you store them in the DB.
|