問題描述
我使用的是 SQL Server 2008,我需要在大約 500k 行的表上將 VARCHAR 字段設(shè)置得更大,從(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)
我已經(jīng)在一份數(shù)據(jù)副本上嘗試過,這個聲明沒有我能看到的不良影響.
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.
推薦答案
這只是元數(shù)據(jù)更改:它很快.
This is a metadata change only: it is quick.
觀察:如果 SET ANSI_xx 設(shè)置之一不同,則明確指定 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
這篇關(guān)于在大表上增加 VARCHAR 列的大小時會出現(xiàn)任何問題嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!