Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
brendalisalowe
Constraint Violating Yak Guru
269 Posts |
Posted - 2005-05-03 : 16:57:26
|
| I am trying to run the following on MSDE. But it gives me this error:The following error occured while executing the query:Server: Msg 156, Level 15, State 1, Line 8Incorrect syntax near the keyword 'CREATE'.Do I have the wrong permissions or something?/******************************//**** Drop/Create Database ***//******************************/IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'introaspdotnet') DROP DATABASE introaspdotnetGOCREATE DATABASE introaspdotnetGOUSE introaspdotnetGO--Grant ASPNET access and dataread/write permissionsDECLARE @ASPNETUserAccount NVARCHAR (255)SET @ASPNETUserAccount = @@SERVERNAME + '\ASPNET'IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = @ASPNETUserAccount) EXEC sp_grantlogin @ASPNETUserAccountIF NOT EXISTS (SELECT * FROM dbo.sysusers WHERE name = @ASPNETUserAccount) EXEC sp_grantdbaccess @ASPNETUserAccountEXEC sp_addrolemember N'db_datareader', @ASPNETUserAccountEXEC sp_addrolemember N'db_datawriter', @ASPNETUserAccountGOCREATE TABLE movies ( movie_id INT IDENTITY(1,1) NOT NULL CONSTRAINT pk_movies PRIMARY KEY CLUSTERED, title NVARCHAR(64) NOT NULL, release_date DATETIME NOT NULL)GO CREATE TABLE reviews ( review_id INT IDENTITY(1,1) NOT NULL CONSTRAINT pk_reviews PRIMARY KEY CLUSTERED, movie_id INT NOT NULL CONSTRAINT fk_reviews_movies FOREIGN KEY (movie_id) REFERENCES movies (movie_id), summary VARCHAR(64) NOT NULL, rating INT NOT NULL, review NVARCHAR(512) NOT NULL, reviewer NVARCHAR(64) NULL)GOBrendaIf it weren't for you guys, where would I be? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-05-03 : 17:42:03
|
| How are you running this through MSDE? Via osql.exe? If so, then did you put the above into a script file then use the i switch to tell it the name of the file with the commands?Tara |
 |
|
|
|
|
|
|
|