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
 SQL Server Administration (2008)
 Help needed in creating a database from script

Author  Topic 

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2010-04-07 : 07:54:09
I am using a sql server 2008

I have a database which have 6 filegoups
1 Primary
2 MYDBNAME_clusterindex
3 MYDBNAME_nonclusterindex
4 MYDBNAME_BigTable1
5 MYDBNAME_BigTable2
6 MYDBNAME_BigTable3

Then for Files I have 7 file
# Local Name FileGroup FileName
1 MYDBNAME Primary MYDBNAME.mdf
2 MYDBNAME_clusterindex MYDBNAME_clusterindex MYDBNAME_1.ndf
3 MYDBNAME_nonclusterindex MYDBNAME_nonclusterindex MYDBNAME_2.ndf
4 MYDBNAME_BigTable1 MYDBNAME_BigTable1 MYDBNAME_3.ndf
5 MYDBNAME_BigTable2 MYDBNAME_BigTable2 MYDBNAME_4.ndf
6 MYDBNAME_BigTable3 MYDBNAME_BigTable3 MYDBNAME_5.ndf
7 MYDBNAME_log Not applicable MYDBNAME_6.ldf

My tables have certain cluster and non cluster index
My large Tables[Table1, Table2, Table3] cluster index [primary key] are saved MYDBNAME_BigTable1, MYDBNAME_BigTable2, MYDBNAME_BigTable3

Now I wanted a single script which i can provide to client which should create whole database there
How Can I do that?

Kamran Shahid
Sr. Software Engineer
(MCSD.Net,MCPD.net)

DBA in the making
Aged Yak Warrior

638 Posts

Posted - 2010-04-07 : 08:26:48
Right click on the database in SSMS, select "Tasks", and then "Generate Scripts...". In the dialog, make sure you read and understand all the available options.

There are 10 types of people in the world, those that understand binary, and those that don't.
Go to Top of Page

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2010-04-07 : 08:56:59
I know about the scripts of table,functions, SP's ,views e.t.c.
My question were mainly related to creating filegroups and indexes.
check my question on
[url]http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/497d8bdb-f700-4162-80eb-0c9fcdf08c08[/url]

Kamran Shahid
Sr. Software Engineer
(MCSD.Net,MCPD.net)

Go to Top of Page

DBA in the making
Aged Yak Warrior

638 Posts

Posted - 2010-04-07 : 09:24:30
The options in the Generate Scripts dialog will allow you to script those.

There are 10 types of people in the world, those that understand binary, and those that don't.
Go to Top of Page
   

- Advertisement -