How to use the CREATE LOGIN sql statement?

Viewed 40042

How to use the CREATE LOGIN statement on SQL Server 2005?

I've tried nearly everything: with commas, without them, with strings, without them, etc.

CREATE LOGIN @loginame WITH PASSWORD = 'pass', 
DEFAULT_DATABASE='dbname' DEFAULT_LANGUAGE='us_english', CHECK_POLICY= OFF;

I always get this error:

Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

3 Answers

The best way is to use above statements but as a string, and then evaluete/exe this string as a command.

Related