-- 7777777777777777777777777777777

USE CMAP_Dev 
GO

-- 1 - Create the synonym
CREATE SYNONYM [dbo].[Customer] 
FOR [JTKLaptop].[AdventureWorks].[Sales].[Customer]
GO
EXEC sys.sp_addextendedproperty @name=N'Description', @value=N'This is a sample synonym 
referencing the AdventureWorks database' , 
@level0type=N'SCHEMA',@level0name=N'dbo', 
@level1type=N'SYNONYM',@level1name=N'Customer'
GO

-- 2 - Insert into the synonym
INSERT INTO [CMAP_Dev].[dbo].[Customer] 
           ([TerritoryID]
           ,[CustomerType]
           ,[rowguid]
           ,[ModifiedDate])
     VALUES
           (1
           ,'S'
           ,'718061C8-9D6D-4902-9B8D-92C3AB42CE9E'
           ,'2007-10-12 14:42:12.467')

-- 3 - Validate the record exists
SELECT * 
FROM [CMAP_Dev].[dbo].[Customer] 
WHERE rowguid = '718061C8-9D6D-4902-9B8D-92C3AB42CE9E'
GO


-- 4 - Insert into the base table
INSERT INTO [AdventureWorks].[Sales].[Customer] 
           ([TerritoryID]
           ,[CustomerType]
           ,[rowguid]
           ,[ModifiedDate])
     VALUES
           (1
           ,'S'
           ,'F751BE04-9633-466E-BB51-8E7F3A1D106B'
           ,'2007-10-12 14:42:12.467')

-- 5 - Validate the record exists
SELECT * 
FROM [AdventureWorks].[Sales].[Customer] 
WHERE rowguid = 'F751BE04-9633-466E-BB51-8E7F3A1D106B'
GO

