Tuesday, March 1, 2011

SQL Server - Create a Login

This article will give a walkthrough on creating a SQL Login user.

Step 1

Login to SQL Server 2008 instance using windows authentication
Image1.gif

Step 2

Right click on server instance name and select properties.

Image2.gif


Step 3

Property window will be open. In that select the Security tab.

Image3.gif

In server authentication tab you can see your SQL Server in configured for

  1. Windows authentication mode
  2. SQL Server and Windows Authentication mode
So if you want to enable SQL User login to SQL Server then select checked mixed mode here .
Image4.gif

And then click ok. Now SQL Server is configured for mixed mode login.

Step 4

Now to create SQL LOGIN, right click on Security tab and select New and then Login .

Image5.gif

Step 5

When you click on Login you will get the below window

Image6.gif

Give the Login Name

Image7.gif

Select SQL Server Authentication and provide your desired password

Image8.gif

Disable Enforce password policy

Image9.gif

Select default database

Image10.gif

Leave default language and click OK to create a new SQL Server login

Now in object explorer you can see User1 login .

Image11.gif

Now at time of connecting to SQL Server login User1 can be used. 

If want to give the Roles you can give it from Server roles of this user.

SQL Server 2005: How To Restore a Database from a Backup

1. Open SQL Server 2005 Management Studio.
2. Connect to the appropriate server.
3. Expand Databases.
4. Right-click the desired database, mouseover Tasks, mouseover Restore and select Database.
5. The Restore Database window will appear.
6. Ensure that the correct database name appears in the To database field. If not, select it from the dropdown.
7. Under Source for restore, select the From device radio button.
8. Click the button next to the textbox to select the device to restore from.
9. The Specify Backup window will appear.

10. Click Add and locate and select the backup file from the Locate Backup File Window. Click OK.
11. Under Select the backup sets to restore, select all three backups (full, transaction log, and differential).
12. In the left pane, select Options.
13. Under Recovery state, ensure that the Restore with Recovery radio button is selected.
14. Click OK to begin restoring the database.
15. Once the restore is complete, a notification box will appear. Click OK to close the box. You have now restored your database to the most recent state.