.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Others >> Post New QuestionBookmark and Share Subscribe to Forum

Creating a user in SQL

Posted By: siba     Posted Date: September 01, 2010    Points:2   Category :Others
What is query for creating user in sql.
How to give privilege to a user.

Responses
Author: Syed Shakeer Hussain             
Posted Date: September 01, 2010     Points: 5   

Hi,

creating a User in Sql :
Syntax:

CREATE USER username [ [ WITH ] option [ ... ] ]

where option can be:

SYSID uid
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'
| CREATEDB | NOCREATEDB
| CREATEUSER | NOCREATEUSER
| IN GROUP groupname [, ...]
| VALID UNTIL 'abstime'


eg:

Create a user with no password:

CREATE USER jonathan;

Create a user with a password:

CREATE USER davide WITH PASSWORD 'jw8s0F4';

Create a user with a password, whose account is valid until the end of 2001. Note that after one second has ticked in 2002, the account is not valid:

CREATE USER miriam WITH PASSWORD 'jw8s0F4' VALID UNTIL 'Jan 1 2002';

Create an account where the user can create databases:

CREATE USER manuel WITH PASSWORD 'jw8s0F4' CREATEDB;



For Privalage in SQL,check the following link:-

http://beginner-sql-tutorial.com/sql-grant-revoke-privileges-roles.htm





Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend