vijay Posted April 21, 2006 Share Posted April 21, 2006 HiMy question is like this which is proper way and which one is more faster(1)/(2) from following:(1.) Assume that @qry is large and complex using join and typical conditionscreate proc proc_name @qry varchar(8000)as select * into temp from table1 execute (@qry) drop table tempgo(2) Now in this create proc proc_name @param1,@param2,....as declare @qry varchar(8000) select * into temp from table1 -- here I am set query in var @qry set @qry= select * from tablename if(@param1= something) begin set @qry= @qry + 'where some='+@param1+... end ................ ................ ................ .. .. .. drop table tempgoSo Now tell me which one is appropriate/proper and more faster ?Regards,Vijay Link to comment Share on other sites More sharing options...
aspnetguy Posted April 21, 2006 Share Posted April 21, 2006 I am not sure of speed although I suspect #2 would be faster. #2 would clearly be easier to manage and easier to execute from code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now