Search code examples
sqlt-sqlsql-server-data-tools

SSDT Incorrect syntax near <password> expecting ID or Quoted ID


This script runs fine in SSMS but in my SQL Server Data Tools data project in Visual studio it gives me an error. Script:

create user [myUsername] with password = 'myPassword'

Error:

SQL 80001 : Incorrect Syntax near "myPassword". Expecting ID, or Quoted ID

Solution

  • i think it should be Login instead user

    create LOGIN [myUsername] with password='myPassword' 
    

    OR if login exists

    CREATE USER [myUsername] FOR LOGIN sa WITH DEFAULT_SCHEMA=[dbo]