Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

What is difference between these 2 SP

$
0
0
Hi I have this 2 SP . There is some difference between them. I need a better Analyse about them. For example : One of them cant be profile in (PRC:Complete) more over about their exec plan. and ... . [code="sql"]Create PROCEDURE [dbo].[USP_1] @Par1 NVARCHAR(10)AS BEGIN SELECT TOP 20 * FROM Tab1 with(ReadUncommitted) WHERE (F2 LIKE '%' + @Par1 + '%' ) ENDGo[/code]And this :[code="sql"]Create PROCEDURE [dbo].[USP_2] @Par1 NVARCHAR(10)AS BEGIN Declare @sql nVarchar(2000) Set @sql=Null Set @sql = 'SELECT TOP 20 * '+ 'FROM Tab1 with(ReadUncommitted) '+ 'WHERE (F2 LIKE '+''''+'%' + @Par1 + '%'+''''+' )' Exec (@sql) END[/code]

Viewing all articles
Browse latest Browse all 3145

Trending Articles