February 6, 2012 at 9:37 pm
Hello friends,
Is there any way to add a new db user in sql 2000/2005 through script ?
If yes please provide this sample script..
February 6, 2012 at 10:06 pm
Here is the command for adding user on SQL server 2000/2005
--2000
exec sp_addlogin @loginame='NewLoginName',
@passwd='The Password',
@defdb='Default Database Name', --Optional
@deflanguage='Language' --Optional
exec sp_adduser @loginame='NewLoginName',
@name_in_db='NewUserName',
--2005
CREATE LOGIN NewLoginName
WITH PASSWORD = 'The Password';
USE AdventureWorks2008R2;
CREATE USER NewLoginName FOR LOGIN NewLoginName;
GO
February 6, 2012 at 10:58 pm
sumitagarwal781 (2/6/2012)
Thanks a lot
July 9, 2012 at 3:00 am
what is the difference between 2000 user and 2005 user ?
thanks in advance
sri
July 9, 2012 at 3:14 am
Conceptually both are same.
Login lets you connects to the server
and User has the permissions inside the database.
Only difference is in 2000 the user and schema are clubbed.
In 2005 they are independent
July 10, 2012 at 11:57 pm
To create a database user account for an existing login,
sp_grantdbaccess @loginname = 'loginname'
----------------------------------------------------
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply