469,592 Members | 2,032 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

Does Alter Column do work if column already the same as desired?

I have a table with a column defined thus: LOCNumber Varchar(100) in a
table called Bookdata.

If I execute ALTER TABLE BookData ALTER COLUMN LOCNumber varchar(100)
on the table, does any work get done on the table and column?
Or does SqlServer know that the column is already varchar(100) and
nothing
needs to be done?
If it does do some work, how do you tell it not to run this as it is
already a varchar(100) column. Right now my program just blindly does
this ALTER TABLE
statement regardless of any conditions. Is this a potential problem?
Thanks for any help.

Jul 23 '05 #1
2 1211
SQL 2000 only needs to update meta data when the new varchar column length
is >= the specified length. Consequently, you can skip the length check.

--
Hope this helps.

Dan Guzman
SQL Server MVP

<sd********@msn.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a table with a column defined thus: LOCNumber Varchar(100) in a
table called Bookdata.

If I execute ALTER TABLE BookData ALTER COLUMN LOCNumber varchar(100)
on the table, does any work get done on the table and column?
Or does SqlServer know that the column is already varchar(100) and
nothing
needs to be done?
If it does do some work, how do you tell it not to run this as it is
already a varchar(100) column. Right now my program just blindly does
this ALTER TABLE
statement regardless of any conditions. Is this a potential problem?
Thanks for any help.

Jul 23 '05 #2
Thanks
It is 2000, so everything is fine.

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Dylan Nicholson | last post: by
2 posts views Thread by me | last post: by
11 posts views Thread by Bjørn T Johansen | last post: by
7 posts views Thread by Serge Rielau | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.