0

i have a database called "BILLING_SYSTEM" in sql server 7.0 and I'm using sql server authentication mode to connect to the database with my username "BS" and password "BS".

where my front-end is a VB6.0 application.

now I want to create this security login "BS/BS" from vb6.0 code without opening the enterprise manager console.

so how can I accomplish that?
or is there any T-SQL command for creating users?

any help on this would be highly appreciated. I have already searched in google for many time and nothing got yet. if somebody has any link to any related resources that becomes helpful too.

help plz...........its urgent...

regards
Shouvik

3
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by choudhuryshouvi
0

well this didn't work in sql server 7.0.
your linked article points me to sql server 2005 t-sqls which i donot require at this moment. i wish to do this job in 7.0 version. so, could you give me a sample code?

0

Ok i have figured this out.

thanks to the replied person and all who have paid visit to see this thread.

now this thread is closed.
bye.......

1

Its been a pleasure to share my code here.
This is the code which I used in my application. Hope others will be benefited from this having same problem like me.

[B]''this is for creating the user "BS" and associate it with the "BILLING_SYSTEM database[/B]
EXEC SP_ADDLOGIN 'BS','BS','BILLING_SYSTEM'
USE BILLING_SYSTEM
[B]''these are for granting server roles[/B]
EXEC SP_ADDSRVROLEMEMBER 'BS', 'sysadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'securityadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'serveradmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'setupadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'processadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'diskadmin'
EXEC SP_ADDSRVROLEMEMBER 'BS', 'dbcreator'
[B]''these are for granting various database manipulation permissions[/B]
EXEC SP_ADDUSER 'BS','BS','public'
EXEC SP_ADDROLEMEMBER 'db_owner','BS'
EXEC SP_ADDROLEMEMBER 'db_accessadmin','BS'
EXEC SP_ADDROLEMEMBER 'db_securityadmin','BS'
EXEC SP_ADDROLEMEMBER 'db_ddladmin','BS'
EXEC SP_ADDROLEMEMBER 'db_backupoperator','BS'
EXEC SP_ADDROLEMEMBER 'db_datareader','BS'
EXEC SP_ADDROLEMEMBER 'db_datawriter','BS'
EXEC SP_ADDROLEMEMBER 'db_denydatareader','BS'
EXEC SP_ADDROLEMEMBER 'db_denydatawriter','BS'

Hope the above syntax will be acceptable and one more thing i must say this code is working like snapping knife in butter.

regards
Shouvik

Votes + Comments
Nice job, keep up good work
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.