.net publish to prover creates 'unwanted' role
I am using the publish to provider feature in .net 2008 to produce a database creation script.
In the script exists the following line:
/****** Object: Role [srvTTAS] Script Date: 01/20/2010 09:14:14 ******/
IF NOT E开发者_如何学GoXISTS (SELECT * FROM sys.database_principals WHERE name = N'srvTTAS')
BEGIN
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'srvTTAS' AND type = 'R')
CREATE ROLE [srvTTAS]
This causes a problem as I have a USER called "srvTTAS" setup in my database, and not a role. So when I run this script I have to manually delete the role in order to create a user of the same name. This means the script produced does not create a exact copy of the database in question, is there a way to make publish to provider create a user? (as I have specified in the database?)
The name of any "principal" in the database must be unique. Roles and users are both principals.
Does this publisher have a bug? Or perhaps it can't distinguish principals correctly (for example, Metadata visibility)?
Anyhow, what are using srvTTAS for? For permissioning, it should be a role anyway with your database user in the role.
I suspect the first SELECT statement is missing AND type = 'R'
精彩评论