declare @Sql Nvarchar(4000)
SET @Sql = ‘ select * from a_table ‘
要么这样,
要不然在执行存储过程变量前加N‘‘
ALTER PROCEDURE [dbo].[proc] as BEGIN --这里,varchar要改为nvarchar(4000) declare @Sql nvarchar(4000) SET @Sql = N‘ select * from a_table ‘ -- Insert statements for procedure here exec sp_executesql @Sql select @Sql as ‘@Sql‘ END -
过程需要类型为 'ntext/nchar/nvarchar' 的参数 '@statement'
时间: 2024-11-07 20:05:57