"incorrect syntax near 'GO'"
....weil GO kein
SQL-Statement ist.
Du musst das ganze Script zerlegen, mit "GO"´s splitten.
Dann sieht es in etwa so aus:
Code:
sql = "USE Master "
'
sql ausführen
sql = "IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'kunde') " _
& " DROP DATABASE [kunde]"
'
sql ausführen
sql = "CREATE DATABASE [kunde] ON (NAME = N'kunde'," _
& " Filename = N 'C:\Projects\Databases\kunde.MDF' ," _
& " SIZE = 5," _
& " FILEGROWTH = 10%)" _
& " LOG ON (NAME = N'kunde_Log'," _
& " Filename = N 'C:\Projects\Databases\kunde_Log.LDF' ," _
& " SIZE = 5," _
& " FILEGROWTH = 10%)"
'
sql ausführen
sql = "USE kunde"
'
sql ausführen