DacFx Error SQL46021: TRIGGER does not allow a database name to be specified


i'm using dacfx public model try , manipulate dacpac file before deployment.

@ moment i'm using bits , pieces tutorial (http://blogs.msdn.com/b/ssdt/archive/2013/12/23/dacfx-public-model-tutorial.aspx) copy existing dacpac new dac pac - without alterations.


tsqlmodel model = newtsqlmodel(originaldacpacpath);
tsqlmodel deploymodel = newtsqlmodel(model.version, tsqlmodelextensions.clonemodeloptions(model));

var = model.getobjects(dacqueryscopes.all);
foreach (tsqlobject tsqlobject in everything)
{
string script;
if (tsqlobject.trygetscript(out script))
{
deploymodel.addobjects(script);
}
}

addobjects call throwing dacmodelexception following message: 

"error sql46021: trigger not allow database name specified."

think exception thrown when try , add next item after bad item has been added, 

can't figure out object causing problem.

have order objects being added new dacpac? 

or doing wrong?


i'm betting it's because used dacqueryscopes.all and copying objects don't want other model. 

dacqueryscopes.all shouldn't used during copy operation. can cause problems since may end trying script out system references or other items going break when try , add them new model. i'd bet that's what's happening here - it's either scripting out built in types or perhaps references master database? instead use dacqueryscopes.userdefined copy items in actual model, , maybe dacqueryscopes.samedatabase if want copy composite objects 1 dacpac. apologies if isn't made clear enough in tutorial.

if doesn't work if can send me example of cause error can causing it. cache last script added model if error happened, can log current , previous script along error?

finally, i've created bug track issue error when adding next object, rather when add problematic object. please note don't think it'll make our codebase in time next release we'll track , triage our future releases.



SQL Server  >  SQL Server Data Tools



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........