I'm creating a visual studio database project.
In one of the script, I want to achieve something like
CREATE USER [$(DatabaseName)\UserX]
WITHOUT LOGIN
WITH DEFAULT_SCHEMA = dbo
Which popups error
SQL70604: SqlCmd variable reference is not allowed in object names ($(DatabaseName)\UserX).
After a bit study, the closest solution I found was to create user by sp_executesql
but it will lead schema compare feature invalid right?
I'm not quite familiar with database project, but I imagine there should be some better way to achieve this which I just need some direction.
MachineName\UserName
which can associate to windows group directly. – CoauthorCREATE LOGIN [$(USERDOMAIN)\MyUser] ...
on each domain. – GlycolCREATE LOGIN [$(USERDOMAIN)\MyGroup]...
.Can you clarify what setup you are suggesting? – Glycoldba.stackexchange.com
although I expect you'll get the same answers. For example, How do I assign an entire Active Directory group security access in SQL Server 2008? – Gregoire