此脚本在SSMS中运行良好,但在Visual Studio中的SQL Server数据工具数据项目中,它给出了一个错误。脚本:
create user [myUsername] with password = 'myPassword'
错误:
SQL 80001 : Incorrect Syntax near "myPassword". Expecting ID, or Quoted ID
答案 0 :(得分:2)
我认为它应该是登录而不是用户
create LOGIN [myUsername] with password='myPassword'
如果登录存在,则为
CREATE USER [myUsername] FOR LOGIN sa WITH DEFAULT_SCHEMA=[dbo]