varchar(max) MS SQL Server 2000,有问题吗? [英] varchar(max) MS SQL Server 2000, problems?

查看:48
本文介绍了varchar(max) MS SQL Server 2000,有问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了一个当前运行 SQL Server 2000 作为后端的 asp.net 网站项目.

I've inherited a asp.net website project that currently runs SQL Server 2000 as its backend.

我一直在使用 SQL Server 2005 Express 对数据库的本地副本进行一些数据库更改.我已经使用 varchar(max) 列创建了一个表.它们用于存储任意长度的 XHTML 片段.

I've been doing some databases changes on a local copy of the db using SQL Server 2005 Express. I've create a table using varchar(max) columns. They are used to stored snippets of XHTML that are of arbitrary length.

在stackoverflow上浏览时,我遇到了这个:总是使用 nvarchar(MAX) 有什么缺点吗?

While browsing around on stackoverflow I came across this: Are there any disadvantages to always using nvarchar(MAX)?

用户 mattruma 说他发现了在 SQL Server 2000 上使用 varchar(max) 的困难方法".

User mattruma says he found out the "hard way" about using varchar(max) on SQL Server 2000.

鉴于实时数据库在 SQL Server 2000 上运行,我应该使用什么来代替 varchar(max)?

What should I use instead of varchar(max) given that the live database runs on SQL Server 2000?

在此先感谢您的帮助!

推荐答案

如果您的实时 DB 是 SQL Server 2000,那么 varchar(MAX) 的限制听起来似乎没有实际意义支持他们.如果您要存储超过 8K 个字符,则几乎只剩下其他选项了,一个 TEXT 列.但是,请注意 TEXT 列也有很多限制.

It sounds like the varchar(MAX) limitations are a moot point if your live DB is SQL Server 2000, which doesn't support them. If you have more than 8K characters to store you are pretty much left with the only other option, a TEXT column. However, beware that TEXT columns have a lot of limitations too.

例如,您无法轻松地对它们进行排序或分组,也无法将它们与其他列的等效性进行比较.也就是说,您不能说 Select * from mytable where Mytext1 = mytext2.

For example you can't sort or group on them easily, nor can you compare them for equivalency with other columns. That is you can't say Select * from mytable where Mytext1 = mytext2.

其他相关问题:

  • 我建议您使用 NTextNVarchar 列,无论您支持 Unicode 的方式如何.
  • 如果表有很多其他列,并且 varchar(8000) 列可能经常接近满,那么您可能会遇到 8K 行限制的问题.也要记住这一点.
  • I'd suggest using an NText or NVarchar column regardless of the way you go to support Unicode.
  • If the table has a lot of other columns and the varchar(8000) column is likely to be frequently close to full, you may have problems with the row limit of 8K. Keep this in mind too.

这篇关于varchar(max) MS SQL Server 2000,有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆