July 8, 2008 at 1:24 am
Hi !!!
i have sql server 2000 developer edition installed on my system.
i have created a new database named my_DB
then i have created a new user for the database(my_DB) by this command
USE [master]
GO
CREATE DATABASE my_DB
GO
CREATE LOGIN [my_DBuser]
WITH PASSWORD=N'pass@word1',
DEFAULT_DATABASE=[my_DB],
CHECK_EXPIRATION=OFF,
CHECK_POLICY=OFF
GO
USE [my_DB]
GO
CREATE USER [my_DBuser] FOR LOGIN [my_DBuser] WITH DEFAULT_SCHEMA=[dbo]
but this is giving me an error 'Incorrect syntax near LOGIN'
but the same command is running fine with sql server 2005 express edition.
pls tell me slotion for solving this problem
Thanks in advance
Rahul K
July 8, 2008 at 2:00 am
lakshya.rahul (7/8/2008)
Hi !!!i have sql server 2000 developer edition installed on my system.
i have created a new database named my_DB
then i have created a new user for the database(my_DB) by this command
USE [master]
GO
CREATE DATABASE my_DB
GO
CREATE LOGIN [my_DBuser]
WITH PASSWORD=N'pass@word1',
DEFAULT_DATABASE=[my_DB],
CHECK_EXPIRATION=OFF,
CHECK_POLICY=OFF
GO
USE [my_DB]
GO
CREATE USER [my_DBuser] FOR LOGIN [my_DBuser] WITH DEFAULT_SCHEMA=[dbo]
but this is giving me an error 'Incorrect syntax near LOGIN'
but the same command is running fine with sql server 2005 express edition.
pls tell me slotion for solving this problem
Thanks in advance
Rahul K
The create login and create user is new syntax on SQL Server 2005. Since your database is SQL Server 2000, you will need to use SQL Server 2000 syntax. Something along the lines of:
EXEC master.dbo.sp_addlogin @loginame = N'my_DBUser', @passwd = N'pass@word1', @defdb = N'my_DB'
GO
USE [my_DB]
GO
EXEC dbo.sp_grantdbaccess @loginame = N'my_DBUser', @name_in_db = N'my_DBUser'
Regards,
Andras
July 8, 2008 at 2:50 am
Hi !! Andras
Thanks a lot. it worked for me.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply