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'
- Dns server faults
- Bmc remedy ticketing tool
- Select the even and odd records
- What is dns server ?
- Find and grep command
- Which one of the following in not a client-server?
- How do http server knows if it is static request or dynamic request.?
- What is use of sharepoint and which is supported client os and server os.
- Websphere application server qeustion
- How do you install print server in windows 2008 /2008 r2 server core?
- Test UNIX login
- C drive space
- Data structure to maintain photographs database
- 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.
- 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)?
- What is the command for below question ?