March 9, 2009 at 7:48 pm
I have created a database in sql server 2005 and a list of tables in that database.
Please let me know how can i find username and password of the created database in order to make use of username and password in web.confi file of .net project.
Thanks in advance.
March 9, 2009 at 8:31 pm
Creating a database doesn't create the user name and password.
You can create a new Server Login with following code:
[font="Courier New"]USE [master]
GO
CREATE LOGIN [test] WITH PASSWORD=N'test123', DEFAULT_DATABASE=[DBName], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
USE [DBName]
GO
CREATE USER [test] FOR LOGIN [test]
EXEC sp_addrolemember N'db_datawriter', N'test'
EXEC sp_addrolemember N'db_datareader', N'test'
GO
[/font]
Replace DBName with your database name and replace test with the user name you want for your application.
Thanks.
Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
Microsoft FTE - SQL Server PFE
* Some time its the search that counts, not the finding...
* I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]
March 9, 2009 at 8:37 pm
Thank you. I will try tomorrow.
March 9, 2009 at 8:38 pm
SELECT * from sys.syslogins WHERE dbname='yourdbname'
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply