Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server SQL Server 2000中的Varchar(max)_Sql Server_Variables_Sql Server 2000 - Fatal编程技术网

Sql server SQL Server 2000中的Varchar(max)

Sql server SQL Server 2000中的Varchar(max),sql-server,variables,sql-server-2000,Sql Server,Variables,Sql Server 2000,在存储过程中,我必须有一个最大大小的varchar变量 declare @a varchar(max) 这适用于SQL Server 2005\08\12,但不适用于2000 我不需要存储过程在SQLServer2000上工作,我只需要编译此指令而不出错 我认为一个可能的解决办法是: declare @SqlText nvarchar(100) set @SqlText = 'declare @a varchar(max)' exec sp_executesql @SqlText 但是这样,

在存储过程中,我必须有一个最大大小的
varchar
变量

declare @a varchar(max)
这适用于SQL Server 2005\08\12,但不适用于2000

我不需要存储过程在SQLServer2000上工作,我只需要编译此指令而不出错

我认为一个可能的解决办法是:

declare @SqlText nvarchar(100) set @SqlText = 'declare @a varchar(max)'
exec sp_executesql @SqlText
但是这样,如果我试图使用变量
@A
编译,我会得到一个错误,说我必须声明变量@A


有什么可能的解决办法吗

SQL Server 2000不支持
VARCHAR(MAX)
,但您可以使用SQL Server 2012(和2014)中仍然支持的
TEXT
。会的,但现在对你有用

DECLARE @a TEXT

您是否使用SSDT构建数据库项目?答案已在本答案[varchar(max)MS SQL Server 2000,问题?][1]中提供,此处[SQL Server 2000中varchar(max)的最大大小][2][1]:[2]: