Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 CREATE LOGIN

Author  Topic 

map
Starting Member

4 Posts

Posted - 2011-08-04 : 07:01:21
Hi All - I am running this:

USE MASTER
GO
CREATE LOGIN [map] WITH PASSWORD=N'newyork'

and I get this:

Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'LOGIN'.

Any thoughts?

Thanks,
Mark.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-08-04 : 07:37:52
I don't have any ideas, except to say that I copied your code and ran on my SQL 2008 R2 and it worked without any errors and created the login.
Go to Top of Page

map
Starting Member

4 Posts

Posted - 2011-08-04 : 07:45:37
Hi Sunitabeck - Thanks for the reply. I've found the same thing. Works on my other databases but not on this one. Just can't understand it. Have also tried CREATE LOGIN map WITH PASSWORD='newyork' and various other things but no joy. Very frustrated. I even created the login through the GUI and then scripted it out and I still get the same error.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-08-04 : 07:50:37
maybe is is not a SQL 2008 server ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

map
Starting Member

4 Posts

Posted - 2011-08-04 : 07:56:59
Server properties says its Microsoft SQL Server Enterprise Edition Version 8.00.2282. Not sure but I assume the syntax for creating a user doesn't change much for each version.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-08-04 : 08:07:16
yes it does.

Ver 8 is SQL 2000. Create Login is only available for SQL 2005 and later


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-08-04 : 08:11:50
for SQL 2000, use sp_addlogin
http://msdn.microsoft.com/en-us/library/aa259567%28v=SQL.80%29.aspx

http://msdn.microsoft.com/en-us/library/ms173768%28v=SQL.90%29.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

map
Starting Member

4 Posts

Posted - 2011-08-04 : 08:20:36
Thanks very much khtan. Thats solves my problem. I will use sp_addlogin. Cheers.
Go to Top of Page
   

- Advertisement -