Table definition in SQL Server

If we want to see the table definition in SQL Server, then we can get using sp_help procedure.


sp_helptext [ @objname = ] ‘name’ [ , [ @columnname = ] computed_column_name ]


If we want to get the emp table information:

sp_help emp

Name	Owner	Type	Created_datetime
EMP	dbo	user table	2017-03-09 23:42:23.657
Column_name	Type	Computed	Length	Prec	Scale	Nullable	TrimTrailingBlanks	FixedLenNullInSource	Collation
EMPNO	numeric	no	5	4    	0    	no	(n/a)	(n/a)	NULL
ENAME	varchar	no	10	     	     	yes	no	yes	SQL_Latin1_General_CP1_CI_AS
JOB	varchar	no	9	     	     	yes	no	yes	SQL_Latin1_General_CP1_CI_AS
MGR	numeric	no	5	4    	0    	yes	(n/a)	(n/a)	NULL
HIREDATE	datetime	no	8	     	     	yes	(n/a)	(n/a)	NULL
SAL	numeric	no	5	7    	2    	yes	(n/a)	(n/a)	NULL
COMM	numeric	no	5	7    	2    	yes	(n/a)	(n/a)	NULL
DEPTNO	numeric	no	5	2    	0    	yes	(n/a)	(n/a)	NULL
Identity	Seed	Increment	Not For Replication
No identity column defined.	NULL	NULL	NULL

Table definition in SQL Server

Related Posts

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: