Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change data type on all char(36) columns in db
Message
From
08/09/2013 11:24:03
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01582234
Message ID:
01582511
Views:
32
Thanks, Naomi. That's a great post and is very useful. I'm sure some of the information there will come in handy in the future.

( BTW, for anyone who does SQL who is not familiar with lessthandot.com I really recommend taking a look. Besides Naomi's contributions there are some great articles from a range of experienced SQL people, including Denis Gobo ( sqlDenis ) whom I had the pleasure of working with when he was our DBA at Dow Jones )


>I think you can get ideas from this blog post
>
>http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/how-to-get-information-about-all-databas
>
>
>>How would I create a single script that would do an alter table on every table in a database (over 100) changing the datatype of every column that is char(36) to uniqueidentifier?
>>
>>I'm thinking sp_msforeachtable but the logic after than is based on a columns data type ...
>>
>>And while I'm asking, then make every column named cid ( and uniqueidentifier) the PK
>>
>>(okay that one may be able to do with sp_msforeachtable)
>>
>>(this is part of a conversion of VFP/VFE data and is going to possibly be needed if I can't figure out how to hack the Sedna upsizer to recognize C(36) NOCPTRANS as a uniqueidentifier.
>>
>>( And yes, I probably will explore grabbing the data from the SQL side with SSIS but I'm not sure that will be any easier - isn't there an issue with memo fields?)
>>
>>TSQL gurus, your help appreciated.


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Reply
Map
View

Click here to load this message in the networking platform