Solved

CREATE LOGIN syntax error

Posted on 2010-08-18
6
381 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

867 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

16 Experts available now in Live!

Get 1:1 Help Now