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
 General SQL Server Forums
 Database Design and Application Architecture
 Empty DB structure

Author  Topic 

sqlzagi
Starting Member

11 Posts

Posted - 2007-04-24 : 04:17:41
Hi,

I have to change collation for certain database. I think the only solution is to export or create through scripts the empty db structure (tables, PK & FK, defaults) and thereafter import data.
Since I don't have empty structure of this database I have to create somehow from the existing one which is with data, can somebody suggest how can I do this - take out the structure of the database from the db with data on it. I have 256 tables and I have to order them first with the dependencies of the tables?!

I will be really thankfull if somebody can help me on this issue.

Thnks,
sqlzagi

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-24 : 04:25:37
Use Generate Scripts option from Enterprise Manager to create script for the desired objects in the database.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-24 : 04:40:33
"I have 256 tables and I have to order them first with the dependencies of the tables?!"

Not entirely ... if you script your current database, using the method Harsh suggests, you can then change the Collation of all columns with Char, Varchar and Text datatypes (and their 'N' Unicode variants). Then run that script on a new, empty, database.

HOWEVER, do NOT run the parts of the script that Create the Foreign keys. You may also NOT want to Create any Triggers - which may adjust the data as it is created.

Then DTS the data from the Old Database into the New Database.

Finally run the parts of your Build Script for Foreign Keys (and Triggers if necessary)

Bob's your Uncle!

Kristen
Go to Top of Page

sqlzagi
Starting Member

11 Posts

Posted - 2007-04-25 : 06:00:02
Thanks you guys, It worked with Kristen solution!
Go to Top of Page
   

- Advertisement -