问题描述
我使用的是 SQL Server 2008,我需要在大约 500k 行的表上将 VARCHAR 字段设置得更大,从(200 到 1200).我需要知道的是是否有任何我没有考虑过的问题.
I'm using SQL Server 2008 and I need to make a VARCHAR field bigger, from (200 to 1200) on a table with about 500k rows. What I need to know is if there are any issues I have not considered.
我将使用这个 TSQL 语句:
I will be using this TSQL statement:
ALTER TABLE MyTable
ALTER COLUMN [MyColumn] VARCHAR(1200)
我已经在一份数据副本上尝试过,这个声明没有我能看到的不良影响.
I've already tried it on a copy of the data and this statement had no ill effects that I could see.
那么这样做是否有任何我可能没有考虑过的问题?
So are there any possible problems from doing this that I may not have considered?
顺便说一下,该列未编入索引.
By the way, the column is not indexed.
推荐答案
这只是元数据更改:它很快.
This is a metadata change only: it is quick.
观察:如果 SET ANSI_xx 设置之一不同,则明确指定 NULL 或 NOT NULL 以避免事故",例如出于某种原因在 osql 而非 SSMS 中运行
An observation: specify NULL or NOT NULL explicitly to avoid "accidents" if one of the SET ANSI_xx settings are different eg run in osql not SSMS for some reason
这篇关于在大表上增加 VARCHAR 列的大小时会出现任何问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!