use message
declare @cmd as nvarchar(200)
declare @name as nvarchar(200)
declare @exchange as nvarchar(200)
set @cmd='select username from systemuser where useraccounts=''ABC'''
select @cmd as [email protected]'
exec sp_executesql @cmd,[email protected] nvarchar(200) output',@exchange output
select @exchange as 'Condition'
------解决方案--------------------
- SQL code
declare @cmd nvarchar(8000) declare @exchange nvarchar(200) set @cmd= 'select @username=username from systemuser where useraccounts= ''ABC ''' exec sp_executesql @cmd,N [email protected] nvarchar(200) output ',@exchange output