Solved

CREATE LOGIN syntax error

Posted on 2010-08-18
6
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

739 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