2

I'm trying to automate the database deploy process an I'm using the SqlPackage.exe. I have some database deployment process working with this exe but recently I've been facing an problem to a new database.

When I try to run:

"C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe" /a:Script /op:p_dbprm003.sql /sf:c:\p_dbprm003.dacpac /TargetServerName:servernamexyzw /TargetDatabaseName:p_dbprm003 /Profile:c:\p_dbprm003.publish.xml

I get the message:

The reference to the element with the name '[xxx_user ]' could not be resolved. More than one element with this name exists. To resolve the error, you must add one or more disambiguators.

I really don't know what does it means.

I have a user [xxx_user] and a schema [xxx_user] with the same name. Do you think that it could be an possible cause of the error?

RMalke
  • 4,048
  • 29
  • 42
Aitiow
  • 882
  • 2
  • 9
  • 18
  • I do think the name being equal can be the reason for the error. Is it possible to change one of the object names? If it is, I think it's the easier of the alternatives. – RMalke Jan 09 '15 at 18:01
  • Can you use the actual project? If so, I'd try opening that in SSDT and trying to publish it that way - you might be able to narrow it down a bit more. Also, you have seem to have a space in the name above. If that's the case, you'll need to fix the package/dacpac anyway. – Peter Schott Jan 09 '15 at 18:45
  • Hey Pete, So, I am able to deploy via Visual Studio. The database project compile successfuly and I'm able to deploy it also. Actually I did not understand what you said about fix the package/dacpac.. What you mean???? by the way Thank you for help since now... – Aitiow Jan 11 '15 at 20:41

2 Answers2

0

You must set the path variable of SqlPackage.exe as a system variable.It solved my problem.

chamzz.dot
  • 607
  • 2
  • 12
  • 24
0

For anyone reading this old post, I ran into this same issue today (Sql server 2017) and found a solution. Notice the error message from the original post:

The reference to the element with the name '[xxx_user ]' could not be resolved. More than one element with this name exists. To resolve the error, you must add one or more disambiguators.

Notice that '[xxx_user ]' has a trailing space at the end. Remove the trailing space(s) from your users/schemas, export your .dacpac and the issue should now be resolved.

Mike
  • 1