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'
- What is dns server ?
- Find and grep command
- How do http server knows if it is static request or dynamic request.?
- Websphere application server qeustion
- How do you install print server in windows 2008 /2008 r2 server core?
- How to tune plugin-configuration file in websphere application server
- 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 ?
- Bmc remedy ticketing tool
- Select the even and odd records
- C drive space
- What will happen to the users that are already connected to the database when (alter system enable restricted session;) command is fired in the database.
- Which one of the following in not a client-server?
- What is use of sharepoint and which is supported client os and server os.
- What is memory in server and types of it(paged/non paged)
- RMAN backup
- Voip/wan/it networking performance
- What is the diff b/w jira, bugzilla and tfs(team foundation server)?