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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 wrong permissions?[RESOLVED]

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 8
Incorrect 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 introaspdotnet
GO

CREATE DATABASE introaspdotnet
GO

USE introaspdotnet
GO

--Grant ASPNET access and dataread/write permissions
DECLARE @ASPNETUserAccount NVARCHAR (255)
SET @ASPNETUserAccount = @@SERVERNAME + '\ASPNET'

IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = @ASPNETUserAccount)
EXEC sp_grantlogin @ASPNETUserAccount
IF NOT EXISTS (SELECT * FROM dbo.sysusers WHERE name = @ASPNETUserAccount)
EXEC sp_grantdbaccess @ASPNETUserAccount

EXEC sp_addrolemember N'db_datareader', @ASPNETUserAccount
EXEC sp_addrolemember N'db_datawriter', @ASPNETUserAccount
GO

CREATE 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
)
GO

Brenda

If 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
Go to Top of Page
   

- Advertisement -