I am using SQLSERVER 2014 Express and I created Employee
Table
I want to know the details Description for the Employee
Table
like NULL or NOT NULL and Datatypes
In Oracle we have desc Employee
like any syntax? Please help me
In SSMS find table you need, right-click on it, choose Script Table As... -> CREATE To -> New Query Editor Window
That will give you creation script where you can see all details about table structure.
Another way is to use system tables:
USE MyDB
SELECT c.name,
s.name,
c.max_length,
c.is_nullable
FROM sys.columns c
LEFT JOIN sys.systypes s
ON s.xusertype= c.system_type_id
WHERE object_id = object_id(N'Employees')
This will give you:
name name max_length is_nullable
EmployeeID int 4 0
LastName nvarchar 40 0
FirstName nvarchar 20 0
...etc
Or views:
USE MyDB
SELECT TABLE_NAME,
COLUMN_NAME,
DATA_TYPE,
IS_NULLABLE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Employees';
Output:
TABLE_NAME COLUMN_NAME DATA_TYPE IS_NULLABLE
Employees EmployeeID int NO
Employees LastName nvarchar NO
Employees FirstName nvarchar NO
Employees Title nvarchar YES
Note: also you can use EXEC sp_help 'Employees'
more about this SP you can read on MSDN.