create database script with corresponding data files

  • is there a way to get create database script to include all the data files associated

    with the database?

    would like to include all the tabes & indexes as well, but not able to find a way to

    do this from ssms

  • create database MyDB

    on primary, secondary, tertiary

    That will create the database MyDB on the primary, secondary and tertiary filegroups. You'll have to use your actual filegroup names, of course, and a real database name, but that's the syntax.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • tables, views, etc are NOT files. They are objects within a database file. You can have multiple database files per database, but those do not determine the tables, etc.

    You script tables, views, functions, etc. separately from the database.

    If you want to see how this works, I think the sample databases (Northwind/pubs) that you can download show scripts that create the db, objects, and then populate things.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply