I noticed that, in my DacPac, after a deployment, two stored procs were given a modified date on sys.objects
, almost to the same millisecond. However, I would only expect one of them to have this, since I only updated one proc. The other proc that was updated calls the one that was updated, but I didn't modify it directly.
Has anyone seen this behavior? Is it expected with DacPac, that the calling stored proc gets "modified" even though there is no actual code change, or could it be something else?
My concern is for a number of reasons, mainly related to QA people questioning this, and ultimately it isn't a good idea to see a proc has been modified when you can't explain why.
Any help appreciated.
Best Answer
Yes, it's expected.
If
StoredProcA
callsStoredProcB
, andStoredProcB
is modified, then the DacPac deployment will:StoredProcB
StoredProcA
What that looks like in the generated deployment script is:
It's the call to
sp_refreshsqlmodule
that updates the modified date onStoredProcA
. The procedure hasn't been redeployed, but it's underlying metadata may have.In your case, nothing has really changed. The whole
sp_refreshsqlmodule
thing would be necessary if you updated a user-defined type that was used a parameter toStoredProcA
, for example. It's not necessary in this situation, but SSDT doesn't have complex rules about when to refresh dependent modules - it just updates them all if any have changed.