Answers for "Creating a SQL SYNONYM"

SQL
0

Creating a SQL SYNONYM

-- Create a synonym for the Product table in AdventureWorks2012.  
CREATE SYNONYM MyProduct  
FOR AdventureWorks2012.Production.Product;  
GO  
  
-- Query the Product table by using the synonym.  
SELECT ProductID, Name   
FROM MyProduct  
WHERE ProductID < 5;  
GO
Posted by: Guest on October-21-2021
0

Creating a SQL SYNONYM

-- Create a synonym for the Product table in AdventureWorks2012.  
CREATE SYNONYM MyProduct  
FOR AdventureWorks2012.Production.Product;  
GO  
  
-- Query the Product table by using the synonym.  
SELECT ProductID, Name   
FROM MyProduct  
WHERE ProductID < 5;  
GO

Results
----------------------- 
ProductID   Name 
----------- -------------------------- 
1           Adjustable Race 
2           Bearing Ball 
3           BB Ball Bearing 
4           Headset Ball Bearings 

(4 row(s) affected)
Posted by: Guest on October-21-2021
0

Creating a SQL SYNONYM

-- SQL Server Syntax  
  
CREATE SYNONYM [ schema_name_1. ] synonym_name FOR <object>  
  
<object> :: =  
{  
    [ server_name.[ database_name ] . [ schema_name_2 ]. object_name   
  | database_name . [ schema_name_2 ].| schema_name_2. ] object_name  
}
Posted by: Guest on October-21-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language