Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CREATE LOGIN syntax error

Posted on 2010-08-18
6
Medium Priority
?
403 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 668 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 668 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 664 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
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
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.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

670 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