Solved

CREATE LOGIN syntax error

Posted on 2010-08-18
6
389 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

840 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