Solved

CREATE LOGIN syntax error

Posted on 2010-08-18
6
380 Views
Last Modified: 2012-05-10
when trying to create a login,
CREATE LOGIN [PRIC_1_TEST] WITH DEFAULT_DATABASE=[TRACKER]
i get the error
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'TRACKER'.

what else is needed to create a login?

thanks
0
Comment
Question by:anushahanna
6 Comments
 
LVL 3

Accepted Solution

by:
PrakashRaoBS earned 167 total points
ID: 33465161
check the following query
USE [master]
GO
EXEC master.dbo.sp_addlogin @loginame = N'PRIC_1_TEST', @passwd = N'', @defdb = N'TRACKER'

Open in new window

0
 
LVL 58

Assisted Solution

by:cyberkiwi
cyberkiwi earned 167 total points
ID: 33465178
CREATE LOGIN loginName { WITH <option_list1> | FROM <sources> }

<option_list1> ::=
    PASSWORD = { 'password' | hashed_password HASHED } [ MUST_CHANGE ]
    [ , <option_list2> [ ,... ] ]

<option_list2> ::=  
    SID = sid
    | DEFAULT_DATABASE = database    

You are missing the PASSWORD= clause
CREATE LOGIN [PRIC_1_TEST] WITH PASSWORD='test', DEFAULT_DATABASE = [TRACKER]

Open in new window

0
 
LVL 7

Assisted Solution

by:jmiller47
jmiller47 earned 166 total points
ID: 33465216
You need WITH PASSWORD ='MyPassword' or FROM WINDOWS depending if this is a local user account (to sql server) or a Windows user.

CREATE LOGIN [PRIC_1_TEST] WITH PASSWORD= 'MyPassword', DEFAULT_DATABASE=[TRACKER];
GO

OR

CREATE LOGIN [PRIC_1_TEST] FROM WINDOWS WITH DEFAULT_DATABASE=[TRACKER];
GO
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 3

Expert Comment

by:PrakashRaoBS
ID: 33465226
you need to give password complusory. see the following code,
CREATE LOGIN [PRIC_1_TEST] WITH password = 'Test123533', DEFAULT_DATABASE=[TRACKER]

Open in new window

0
 
LVL 7

Expert Comment

by:jmiller47
ID: 33465230
I guess I can't post fast enough. :) I didn't meant o post the same as everyone else, I'm just too slow... :)
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33465240
helped. thanks very much,experts.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now