SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Performance Best Practice Simple Question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

andrewcw
Posting Yak Master

USA
129 Posts

Posted - 02/12/2012 :  20:42:23  Show Profile  Reply with Quote
Is there a significant of a performance penalty from having a parameter to either use one set of tables or another ? One input parameter would allow me to use either queries.

If the SQL query can be combined like this I have less stored procedures to call from the application & just a large set of queries separated by 1 input parameter

Thanks

andrewcw

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 02/12/2012 :  23:41:21  Show Profile  Reply with Quote
do you mean call query dynamically based on condition?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

GilaMonster
Flowing Fount of Yak Knowledge

South Africa
4507 Posts

Posted - 02/13/2012 :  03:56:07  Show Profile  Visit GilaMonster's Homepage  Reply with Quote
Generally, yes.
http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/

But it's not just performance. Would you write a class or function in a front end language that can do one of several different things depending on a setting? I'm sure not, because it violates all sorts of design and programming principals (eg single responsibility). Same with stored procedures, a procedure should do one thing, not one of several depending on a parameter, that's just bad programming practice.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

andrewcw
Posting Yak Master

USA
129 Posts

Posted - 02/13/2012 :  14:51:26  Show Profile  Reply with Quote
Thanks for the link and discussion.

andrewcw
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000