Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Trouble running a script to (re)create a database

$
0
0

I have used the "Generate Scripts" wizard/thingy to create a script to create a database (Meterbilling), build the tables etc.

To run this from .net using SqlCoomand.ExecuteNonQuery I know I have to edit it and replace all the 'GO'  commands with semicolon.

But I still get an error.  After the Create database (and the Alter Database statements that follow it, there is a USE [Meterbilling] " statement.  

This gives an error that the database does not exist.  And it doesn't exist either, if I look afterwards.

If I truncate the file just before this, the database is created without error.

Do I need some kind of Execute Statement before the USE statement? 'GO' just gives a syntax error.

Thanks


David Gordon-Brown


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>