C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » SQL »

How to create a user account database


Posted Date: 22 Nov 2008    Resource Type: Code Snippets    Category: SQL
Author: SanthiMember Level: Gold    
Rating: 1 out of 5Points: 7



This is to create a simple User Management Database

1. USE master
2. GO
3. IF EXISTS (SELECT * FROM master.sysdatabases WHERE name =
4. 'UserAcc')
5. DROP DATABASE UserAcc
6. GO
7. CREATE DATABASE UserAcc
8. GO
9. USE UserAcc
10. GO
11. CREATE TABLE [Users] (
12. [UserName] [varchar] (20) NOT NULL ,
13. [PasswordHash] [varchar] (40) NOT NULL ,
14. CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED
15. (
16. [UserName]
17. ) ON [PRIMARY]
18. ) ON [PRIMARY]
19. GO
20. CREATE PROCEDURE RegisterUser
21. @userName varchar(25),
22. @passwordHash varchar(30)
23. AS
24. INSERT INTO Users VALUES(@userName, @passwordHash)
25. GO
26. CREATE PROCEDURE LookupUser
27. @userName varchar(25)
28. AS
29. SELECT PasswordHash
30. FROM Users
31. WHERE UserName = @userName
32. GO
33. exec sp_grantlogin [Computer Name\ASPNET]
34. exec sp_grantdbaccess [Computer Name\ASPNET]
35. grant execute on LookupUser to [Computer Name\ASPNET]
36. grant execute on RegisterUser to [Computer Name\ASPNET]



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
User database  .  User Account Database  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Returning String Instead of NULL
Previous Resource: Code Geting column name of Excel sheet to create sql table
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use