Competition: What’s your favorite Redgate tool? Enter now.

NON-ISSUE Database Qualifier Change in Synonym Not Detected

MCTSQLMCTSQL Posts: 14 Bronze 3
edited August 12, 2016 8:42AM in SQL Source Control
This is a non-issue. Please ignore. I had the "Ignore Database and server name in synonyms" enabled.

I recently encountered a synonym containing a database qualifier (database.dbo.object). When I removed the database qualifier, SQL Source Control detected no changes (using TFS or Evaluation Repository).
Here's a test for the situation:
/* SQL Source Control: Version 5.1.0.2572 standard

   Database Qualifier in Synonym

   Scenario:
      Two databases in one instance on one server
   Action:
      Remove database qualifier from synonym
   Expected Result:
      SQL Source Control should detect this change
   Actual Result:
      SQL Source Control does NOT detect this change
*/

--setup
use master;
go
drop database SynonymTest;
go
create database SynonymTest;
go
drop database SynonymTest2;
go
create database SynonymTest2;
go
use SynonymTest;
go
create synonym MySynonym for SynonymTest2.sys.tables;
go
--check in database SynonymTest to Source Control
   --Note: tested with TFS and Evaluation Repository
go

--modify synonym
drop synonym MySynonym;
go
create synonym MySynonym for sys.tables;
--OR: create synonym MySynonym for SynonymTest.sys.tables;
go
--within SQL Source Control, check for changes in SynonymTest
   --change NOT detected when using Evaluation Repository
   --change NOT detected when using TFS
MCTSQL
Sign In or Register to comment.