question

santoshvicky avatar image
santoshvicky asked

sql server 2005 create blank database with master table,Creating script for blank db with master table

I want to create script to create Blank database which contains master table for which I want to maintain data and transaction table which should be blank. I am using SQL Server 2005.,
sql-server-2005create-database
10 |1200 characters needed characters left characters exceeded

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

1 Answer

· Write an Answer
Grant Fritchey avatar image
Grant Fritchey answered
I probably don't completely understand the question, but from the sounds of it, you don't want a blank database, but rather a database with two tables, one of which has data. Why don't you simply create a script that does exactly what you need? CREATE DATABASE x...; CREATE TABLE [Master]...; CREATE TABLE [Transaction]...; INSERT INTO [Master]...; Another option would be to add these tables to your model database. This would then make them automatically appear in any database you create on that server. PS: I assumed the table names, but it's a very bad habit to use reserved words as table names. It can lead to all sorts of problems.
2 comments
10 |1200 characters needed characters left characters exceeded

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

Hey Grant thanks for the prompt reply, I can do it in a way as you suggested. The problem is that the table contains lots of data in my master tables for which I want auto script for insertion which should take care of foreign key relation ship, identity etc.
0 Likes 0 ·
You might then want to look to a 3rd party tool to help out. Red Gate SQL Compare & SQL Data Compare can do exactly this sort of thing. DISCLAIMER: I work for Red Gate
0 Likes 0 ·

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.