Archive for June 14th, 2008

How do I check if a SQL Server 2005 installation has been Service Packed?

You can check whether a SQL Server 2005 installation has been service packed by running the following SQL code:

SELECT SERVERPROPERTY (‘productlevel’)

If SQL Server has been service packed, it will return with the Service Pack version installed, eg. “SP2″. If it has not been service packed, it will return with the result “RTM”.

Add comment June 14, 2008

How do I create and use a Synonym for a table in SQL Server 2005?

To create a synonym, run the following SQL code:

USE AdventureWorks;
GO
CREATE SYNONYM MyLocation
FOR AdventureWorks.Production.Location;
GO

To use the synonym, run the following SQL code:

USE AdventureWorks;
GO
SELECT TOP 5 * FROM MyLocation;
GO

To drop the synonym, run the following SQL code:

USE AdventureWorks;
GO
DROP SYNONYM MyLocation;
GO

Add comment June 14, 2008


Calendar

June 2008
M T W T F S S
    Jul »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Recent Posts

Archives

Blog Stats