Page 1 of 1

Create Database

Posted: Sat 04 Jun 2005 15:40
by cooltool
Hello, what is wrong with this script ? I get a lot of errormessages from SDAC and the DB SQL Monitor when executing the script with SDAC SQLScript

Script: (created with EMS SQL Manager)

CREATE DATABASE [rgea]
ON PRIMARY
( NAME = [rgeadat],
FILENAME = 'C:\Programme\Borland\Delphi7\Projects\rgea.21\daten\rgeadat.mdf',
SIZE = 1 MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10 % )
LOG ON
( NAME = [rgealog],
FILENAME = 'C:\Programme\Borland\Delphi7\Projects\rgea.21\daten\rgealog.ldf',
SIZE = 1 MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10 % )
GO

Delphi Code to use the script

begin
If Script.FileName>'' Then
Begin
SQLServer.Server:= Servername.Text;
SQLServer.Username:= Benutzer.Text;
SQLServer.Password:= Passwort.Text;
SQLServer.Database:= 'master';
SQLServer.Connected:= True;
SQLScript.SQL.Clear;
SQLScript.SQL.LoadFromFile(Script.FileName);
SQLScript.Execute;
End;
end;

Best regards
Stefan

Posted: Mon 06 Jun 2005 14:09
by Ikar
"GO" in the script is unnecessary. What errors do you have? Try to execute the same script in QueryAnalyzer.

Posted: Mon 06 Jun 2005 16:10
by Guest
Hi Ikiar,

thanks for your help,
i removed the go statment and exit Delphi and then i run the program and it worked correctly.

i use MSDE for programming and i have to install the Queryanalyzer from the SQL Server CD. It is a good Program to test the scripts

I thin k that the MSDE had headache that day

Thanks
Stefan