What is diff in below 2 query?? Which one is better in term of performance and why??
declare @id varchar(10) ='207054'
declare @query nvarchar(max)
Set @query= 'select top 1 * from practice where externalid=@id'
print @query
Exec Sp_executeSQL @query,N'@id varchar(10)',@id
Set @query= 'Select top 1 * from practice
where externalid='''+@id+''' '
print @query
Exec Sp_executeSQL @query