-
parse and performance on store procedure
Hi All,
My question is: can the parse of this command bellow afect the perfomance of my store procedure.
SET @sql = 'insert xxx select TOP ' + CAST(@a as varchar)+ ' * from yyy where zzz = ''' + @zzz + ''' and yyy = ''' + @yyy + ''' order by zzz desc, yyy desc, www desc' exec (@sql)
Thanks
Sergio
-
Yes it does.
whenever u r doing a dynamic query make sure u give index hints on select statements
(Index = zzz_yyy_Non_Cluster_Idx)
so that Query optimizer doesnt have work on what plan to choose.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|