declare @Sql Nvarchar(4000)
SET @Sql = ' select * from a_table '
要么这样,
要不然在执行存储过程变量前加N''
ALTER PROCEDURE [dbo].[proc]
as
BEGIN
--这里,varchar要改为nvarchar()
declare @Sql nvarchar()
SET @Sql = N' select * from a_table ' -- Insert statements for procedure here
exec sp_executesql @Sql
select @Sql as '@Sql'
END
-