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 |
|
BENISIZ
Starting Member
11 Posts |
Posted - 2006-06-12 : 10:04:49
|
| I've got a SQL script that should be modified so it can get executed under MSSQL 2005 as well as MSSQL 2000. The scrpt looks like this:---------------------------------------------------------------------------------------------------USE [master]GOIF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')EXEC sp_addlogin N'SSDBUSERNAME', N'SSDBPASSWORD'GOGRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]GOGRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]GOGRANT CONNECT SQL TO [SSDBUSERNAME]GOGRANT CONTROL SERVER TO [SSDBUSERNAME]GOGRANT CREATE ANY DATABASE TO [SSDBUSERNAME]GOUSE [master]GOIf EXISTS (Select * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')ALTER LOGIN [SSDBUSERNAME] WITH PASSWORD=N'SSDBPASSWORD'GOGRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]GOGRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]GOGRANT CONNECT SQL TO [SSDBUSERNAME]GOGRANT CONTROL SERVER TO [SSDBUSERNAME]GOGRANT CREATE ANY DATABASE TO [SSDBUSERNAME]GOUSE [master]GOIF EXISTS (select * from dbo.sysdatabases where name = 'ISIZ')DROP DATABASE [ISIZ]GOUSE [SurveyData]GOexec sp_adduser 'SSDBUSERNAME'GRANT INSERT, UPDATE, SELECT, DELETETO SSDBUSERNAMEGO USE [SurveyManagement]GOexec sp_adduser 'SSDBUSERNAME'GRANT INSERT, UPDATE, SELECT, DELETETO SSDBUSERNAME-------------------------------------------------------------------I've got no problem with exeuting it under MSSQL 2005 but it fails on MSSQL 2000, can anybody help me with this issue?!Thanks,Ben |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-06-12 : 10:08:09
|
| There is a lot here that isn't available in v2000 - you will need to have two scripts or at least an if statement to execute different things on the two servers.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
BENISIZ
Starting Member
11 Posts |
Posted - 2006-06-12 : 10:14:41
|
| Thanks for your quick reply,I just need a script that gives me the same result in MSSQL 2000. The rest is not gonna be a problem. I want to give my user SELECT, UPDATE, DELETE and INSERT rights and my user should be able to connect to the database.It would be great if i could change the password of my user in case he/she exists. |
 |
|
|
BENISIZ
Starting Member
11 Posts |
Posted - 2006-06-12 : 11:00:19
|
| Any idea's ?!!!!!!!!! |
 |
|
|
BENISIZ
Starting Member
11 Posts |
Posted - 2006-06-13 : 04:52:41
|
I'm now in a position where i can make a nwe login accoutn and add it to the database. the only thing i'm having problems with is giving my user SELECT, UPDATE, DELETE permissions on the hole datbase. Every time try to do thsi i get the following error:Invalid object name 'MyDatabaseName'.i've tried the following sql statements:1. GRANT INSERT, UPDATE, SELECT, DELETE on MyDatabaseName TO SSDBUSERNAME2. GRANT INSERT, UPDATE, SELECT, DELETE on 'MyDatabaseName' TO SSDBUSERNAME3. GRANT INSERT, UPDATE, SELECT, DELETE on [MyDatabaseName] TO SSDBUSERNAMEAny idea what the problem might be?!quote: Originally posted by nr There is a lot here that isn't available in v2000 - you will need to have two scripts or at least an if statement to execute different things on the two servers.
|
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-06-13 : 04:57:02
|
| mydatabasename should be a tablename if you're giving all permissions on the entire database, just add the user as member of db_datawriter and db_datareader rolessp_addrolemember--------------------keeping it simple... |
 |
|
|
BENISIZ
Starting Member
11 Posts |
Posted - 2006-06-13 : 06:25:42
|
Thanks for the quick reply,It worked like a charm...quote: Originally posted by jen mydatabasename should be a tablename if you're giving all permissions on the entire database, just add the user as member of db_datawriter and db_datareader rolessp_addrolemember--------------------keeping it simple...
|
 |
|
|
|
|
|
|
|