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 06, 2012 9:37 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, April 11, 2014 5:50 AM
Points: 11, Visits: 68
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 06, 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 06, 2012 10:58 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, April 11, 2014 5:50 AM
Points: 11, Visits: 68
[quote]sumitagarwal781 (2/6/2012)



Thanks a lot

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

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, April 14, 2014 10:04 AM
Points: 2, Visits: 98
what is the difference between 2000 user and 2005 user ?

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


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Monday, April 07, 2014 12:42 AM
Points: 613, Visits: 1,252
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


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, April 10, 2014 6:20 PM
Points: 220, Visits: 695
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