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 2005 Forums
 SQL Server Administration (2005)
 Column definition

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-21 : 17:36:13
I need to alter many of the columns in several tables. While doing this I need to retain all the existing column properties.

Does any one have a script to get the column definition?




------------------------
I think, therefore I am - Rene Descartes

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-21 : 17:38:30
Just generate the script in Management Studio.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-21 : 17:42:48
I need to generate a dynamic ALTER TABLE ALTER COLUMN script from syscolumns , hope I am not confusing you…


------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-21 : 17:53:46
Perhaps you should be more clear by showing us what you intend to do.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-21 : 18:14:42
quote:
Originally posted by ravilobo

I need to generate a dynamic ALTER TABLE ALTER COLUMN script from syscolumns , hope I am not confusing you…


------------------------
I think, therefore I am - Rene Descartes




What do you mean? Scripting with generate script will also give your current column properties?
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-21 : 19:21:52
My apologies for all the confusion.
In simple terms, I am trying to change the collation of few columns, in some of the tables. However I also need to retain the existing properties. Hope it is clear now....

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-21 : 22:33:57
>> I need to generate a dynamic ALTER TABLE ALTER COLUMN script from syscolumns

You can generate statements that way, and it shouldn't affect column properties.
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-21 : 23:22:37
I found that, I can not change the collation, unless i drop the constraints and indexes. (I need to verify this).

Is there some kind of script to achieve this?

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2008-07-22 : 09:35:44
Got the below scripts, thinking of using one of them,
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_22982108.html
http://www.dbforums.com/archive/index.php/t-557509.html
http://vbnetsample.blogspot.com/2007/07/you-can-change-your-database-collation.html






------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page
   

- Advertisement -