What is DESCRIBE command in SQL Server?
Editorial / Best Answersuji
Here are multiple ways to get the table information. The DESCRIBE command does not exist in MS SQL SERVER. This is an Oracle command used to describe the structure of objects within a given database. To achieve the same task in MSSQL Server, there are a series of stored procedures with the prefix SP_ that can be used. To view the structure of a table within the current database, use the command
If you would like to see more details, Create your custom procedure
- sp_help 'TABLE_NAME';
Here is another alternative way to get the same information
- CREATE procedure DESCRIBE
- @tablename varchar(256)
- SELECT DISTINCT sCols.colid AS 'order', sCols.name, sTyps.name, sCols.length
- FROM [syscolumns] sCols
- INNER JOIN [systypes] sTyps ON sCols.xtype = sTyps.xtype
- INNER JOIN [sysobjects] sObjs ON sObjs.id = sCols.[id]
- AND UPPER(sObjs.name) = UPPER(@tablename)
- ORDER BY sCols.colid
Here is the usage :
- sp_columns 'TableName' (e.g. sp_columns 'Employee')
- sp_columns [ @table_name = ] object [ , [ @table_owner = ] owner ]
- [ , [ @table_qualifier = ] qualifier ]
- [ , [ @column_name = ] COLUMN ]
- [ , [ @ODBCVer = ] ODBCVer ]
Contributors for the editorial answer : Kewlshiva, srilakshmi.b, raaghav,kevaburg
- EXEC sp_columns @table_name = 'Department', @table_owner = 'sa';
- SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TableName'
- Networking problem
- Request timeout of servers while ping
- The most appriciatable moment in your life?
- What type of proactive measures you take for managing the windows server ?
- Mail server communication issue for all users in a lan
- Describe testing phases?
- How much time should it to take to set up a server with 5 workstations and network it?
- Question on testing
- Getting files in datastage
- Websphere application server qeustion
- How do you install print server in windows 2008 /2008 r2 server core?
- What is memory in server and types of it(paged/non paged)
- How to tune plugin-configuration file in websphere application server
- RMAN backup
- Voip/wan/it networking performance
- What is the diff b/w jira, bugzilla and tfs(team foundation server)?
- What is the command for below question ?
- Ssl hand shake