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.
Author |
Topic |
andrewcw
Posting Yak Master
133 Posts |
Posted - 2012-02-12 : 20:42:23
|
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 parameterThanksandrewcw |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-12 : 23:41:21
|
do you mean call query dynamically based on condition?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2012-02-13 : 03:56:07
|
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 ShawSQL Server MVP |
|
|
andrewcw
Posting Yak Master
133 Posts |
Posted - 2012-02-13 : 14:51:26
|
Thanks for the link and discussion.andrewcw |
|
|
|
|
|