Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I specify which database to write tables to using sql script

Status
Not open for further replies.

tango1948

Programmer
Joined
Dec 23, 2006
Messages
111
Location
IL
Hi I've created an SQL sript file using the Database Publishing Wizard to create schema and Data.
When I run this file in SQL Server Management Studio Express the tables are created under System Databases > Master > Tables even though I've created and selected the new database.
How do I specify the destination database when I run the SQL script.

Thanks for any help

David
 
You need a USE <database_name> statement at the top of your scripts.

Code:
USE MyDB
GO

.....

- Paul
10qkyfp.gif

- If at first you don't succeed, find out if the loser gets anything.
 
Thanks for the info Paul.
How come the Database Publishing Wizard does'nt include the name of the database in the script? Am I missing something?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top