Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Add new user in SQL server 2000/2005 through script Expand / Collapse
Author
Message
Posted Monday, February 6, 2012 9:37 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, April 21, 2014 10:20 PM
Points: 11, Visits: 70
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..
Post #1247799
Posted Monday, February 6, 2012 10:06 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Sunday, September 23, 2012 7:55 AM
Points: 75, Visits: 110

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


java
Post #1247803
Posted Monday, February 6, 2012 10:58 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, April 21, 2014 10:20 PM
Points: 11, Visits: 70
[quote]sumitagarwal781 (2/6/2012)



Thanks a lot

Post #1247811
Posted Monday, July 9, 2012 3:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 22, 2014 9:15 AM
Points: 2, Visits: 103
what is the difference between 2000 user and 2005 user ?

thanks in advance
sri
Post #1326714
Posted Monday, July 9, 2012 3:14 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Yesterday @ 6:50 AM
Points: 617, Visits: 1,278
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


-- Roshan Joe
*******************************************
Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help
Custom cleanup script for backups
Post #1326716
Posted Tuesday, July 10, 2012 11:57 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, September 24, 2014 4:50 PM
Points: 358, Visits: 876
To create a database user account for an existing login,
sp_grantdbaccess @loginname = 'loginname'
Post #1328047
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse