declare @sql nvarchar(2000)
declare @cou int
declare @id varchar(20)
set @id=''
set @sql='select @count=count(*) from emp where id=@id'
exec sp_executesql @sql, N'@count int out,@id varchar(20)', @cou out
,@id
print @cou
@cou接收 @count传出的值
2023-10-12 23:49:22
declare @sql nvarchar(2000)
declare @cou int
declare @id varchar(20)
set @id=''
set @sql='select @count=count(*) from emp where id=@id'
exec sp_executesql @sql, N'@count int out,@id varchar(20)', @cou out
,@id
print @cou
@cou接收 @count传出的值