Pages

Blending Notes: Oracle 11g & SQL Server 2012-The structure of a table


There are multiple ways of retrieve table information. Few days ago I was desperately looking for an Equivalent Command to Oracle command of 'DESC' OR 'DESCRIBE' in SQL SERVER because I badly wanted to get some information about an existing database. This post mainly focus on describing MS SQL Server table using sp_columns and ‘DESCRIBE’ command of Oracle which retrieves column information for the specified table.
For an instance, Employee table includes information like table name, table owner, details about columns, and its physical storage size information referred to as metadata.
These kind of information of a table can retrieves by using the DESCRIBE command of Oracle.





Syntax- Oracle:
  • ¿       DESC[RIBE] <SCHEMA>.tablename


DESCRIBE key word can be shortened to DESC and schema can be omitted. 


Describing EMPLOYEE table using DESCRIBE command in Oracle 

 Syntax- SQL SERVER:
  •      EXEC sp_columns @table_name = ‘EMPLOYEE’;


Above catalog stored procedure returns column information for the EMPLOYEE table also has ability to specifically mention the object owner of the table as well. If you want to retrieve only one column of catalog information you can simply specified as follows,


Walkthrough SQL Server 2012: AdventureWorks


Where did I go wrong with Adventureworks ? 

Adventureworks sample database launched with SQL Server 2012. Earlier we used Northwind and Pubs sample databases however Adventureworks has become a vital aspect of learning new features within SQL Server 2012 and you can downloaded from CodePlexsite(http://msftdbprodsamples.codeplex.com/releases ). 

Every so often I run into something that seems so simple that should just work but doesn’tL .  I tried to attach the Adventureworks sample database (AdventureWroks2012 Data File) using SQL Server Management Studio as follows, 

® Right Click on Databases  
® Attach 
® click Add 
® select the AdventureWorks mdf file