question

Unish avatar image
Unish asked

Model Data Base in sql Server

How can I create a new Database **Without Copying the Data(tables)** of the Model Database(System Database) AS we know when we create a Data Base it will take the structure of the Model Database and i want to avoid take the data from model table. IS there Any possibilities that we can do this.It was in interview question which was asked for me
sql-server-2008sqlserversqlserver 2008r2
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
This site functions according to votes. For all helpful answers below, show this by clicking on the thumbs up next to those answers. If any one answer lead to a solution, indicate this by clicking on the check mark next to that answer.
0 Likes 0 ·
Kev Riley avatar image
Kev Riley answered
Not that I am aware of. If you have objects in `model` that you don't want in new databases, then I'd suggest they should not be in there.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image Kev Riley ♦♦ commented ·
No. It's a template. If the template is wrong, change the template.
1 Like 1 ·
unishB avatar image unishB commented ·
so we can't create database without copying the structure of the Model Database.
0 Likes 0 ·
ThomasRushton avatar image
ThomasRushton answered
I suppose you could do it by creating a new database from a backup of the model database as it was before you created the no-longer wanted objects (or any other blank database)... but what a palaver. And, really, what @Kev Riley said. Don't want objects in your new databases? Don't put them in model. And if you're putting objects in model because you want them to be in tempdb when you restart SQL Server, then shame on you for being so lazy as to not write your code to check for the presence of these objects and create them if they're missing. Or, y'know, [writing a procedure to create these objects and setting it to run on startup][1]. Sorry if that's a bit rant-ish, but I've been bitten by this sort of thing before. (Not my code, I hasten to add!) [1]: http://technet.microsoft.com/en-us/library/ms191129(v=sql.105).aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.