2013-12-30

TSQL - Dynamic SQL execution results into variable


declare @RecordCount as int;
       set @RecordCount = 0;
declare @SQL as varchar(2000);
       set @SQL = 'select @x=FIELD_NAME from TABLE1;';


exec sp_executesql @SQL, N'@x int out', @RecordCount out;

No comments:

Post a Comment