Change column length

I need to change the length of a column column_lengthin more than 500 tables, and the tables should not have records from 10 records to 3 or 4 million records.

1) A column can be just a normal column

create table test(column_length varchar(10))

2) A column may contain a nonclustered index on it.

create table test(column_length varchar(10))

CREATE UNIQUE NONCLUSTERED INDEX column_length_ind ON test (column_length)

3) A column may contain a PRIMARY KEYclustered index on it

create table test (column_length varchar (10))

alter table test add cluster index of primary key to column_length

4) A column can be a composite primary key

5) The column may have a link to a foreign key

In short, a column column_lengthcan be anything.

All I need to do is create scripts to change the length of column_length from varchar(10)tovarchar(50)

, ? ?

, ...

, - , .

? .

+3
2

, . , .

+2

, , . SO fk, forkey kkey, , .

+1

Source: https://habr.com/ru/post/1697518/


All Articles