Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to Update

Author  Topic 

lkiran086
Starting Member

21 Posts

Posted - 2014-06-18 : 02:15:54
I have 100 tables some columns having Varchar(1000) and I Wan to make them NvarCahr(1000) ...

How can I Change them?

rocknpop
Posting Yak Master

201 Posts

Posted - 2014-06-18 : 02:23:19
EXEC sp_msforeachtable 'ALTER TABLE ? ALTER COLUMN COLUMN_NAME NVARCHAR(1000)'

--------------------
Rock n Roll with SQL
Go to Top of Page

lkiran086
Starting Member

21 Posts

Posted - 2014-06-18 : 02:49:33
There is any option to do for all the tables at a time?
Go to Top of Page

rocknpop
Posting Yak Master

201 Posts

Posted - 2014-06-18 : 03:02:24
Please read about sp_msforeachtable. This refers to all the tables in the DB and ? points to each table.

--------------------
Rock n Roll with SQL
Go to Top of Page

lkiran086
Starting Member

21 Posts

Posted - 2014-06-18 : 03:11:18
Thanks
Go to Top of Page

rocknpop
Posting Yak Master

201 Posts

Posted - 2014-06-18 : 03:45:45
welcome

--------------------
Rock n Roll with SQL
Go to Top of Page
   

- Advertisement -