May 12, 2008 at 5:15 pm
If i have a dynamic sql query will it take advantage of indexes?
May 13, 2008 at 12:34 am
Providing there are indexes appropriate for the query, yes
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 13, 2008 at 12:48 am
...and provided that the syntax of the query hasn't made it impossible.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 15, 2008 at 8:08 pm
Thanks guys.
These forums rely on guys like you to share your wealth of knowledge.
- keep up the good work,
cheers,
Paul
May 16, 2008 at 8:51 am
I haven't had to work with dynamic SQL yet, but I've heard some people mention that the execution plan can get messed up some times. You may want to see if this may be a future problem.
eg. Execution plan gets mad and decides to not use an index, may want a hint/etc..
I've seen some articles showing how to replace some dynamic SQL with stored procs so that there's less of an execution plan issue; although, quite limited on what it can replace.
May 16, 2008 at 6:51 pm
In my experience, Dynamic queries are less likely than compiled ones (i.e., sProcs) to do that.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply