日期:2014-05-17 浏览次数:20670 次
select 'CHINA' AS NAME ,'960' AS VALUE INTO TABLE1
declare
@sql1 nvarchar(4000),
@v_database nvarchar(10),
@VALUE nvarchar(5);
SET @v_database = 'GZ'
set @sql1='SELECT @VALUE=VALUE FROM '+@V_database+ '.dbo.TABLE1 WHERE NAME = ''CHINA'''
EXEC sys.sp_executesql @sql1,N'@VALUE nvarchar(5) output',@VALUE OUTPUT
select @VALUE