Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to use DESC command in SQL Server 2012 Management Studio

I have SQL Server 2012 Management Studio. I am trying to create tables using commands.

After creating the table, I try to use the DESC command to view the table structure but it shows error saying

incorrect syntax near the keyword 'DESC'.

The statement is:

DESC doughnut_list;
like image 850
user2974748 Avatar asked Nov 09 '13 20:11

user2974748


People also ask

How do you DESC in SQL Server?

When sorting your result set in descending order, you use the DESC attribute in your ORDER BY clause. For example: SELECT last_name FROM employees WHERE first_name = 'Sarah' ORDER BY last_name DESC; This SQL Server ORDER BY example would return all records sorted by the last_name field in descending order.

How do you DESC a table in SQL?

Since in database we have tables, that's why we use DESCRIBE or DESC(both are same) command to describe the structure of a table. Syntax: DESCRIBE one; OR DESC one; Note : We can use either DESCRIBE or DESC(both are Case Insensitive).

How can check table description in MS SQL Server?

Just select table and press Alt + F1 , it will show all the information about table like Column name, datatype, keys etc.

Why we use DESC command in SQL?

The DESC command is used to sort the data returned in descending order.


2 Answers

You may try to use it like this:-

exec sp_columns doughnut_list

DESC is not an SQL command, it is used in Oracle. You may also try to check sp_columns

Also if you want to view the table defintion you may try use this:

EXEC sp_help doughnut_list

or may be use a short cut by selecting the table and then CTRL+F1 key

On a side note:-

In Sql Server DESC is the short form of DESCending.

In Oracle it is the short form of DESCribe.

like image 83
Rahul Tripathi Avatar answered Nov 05 '22 04:11

Rahul Tripathi


For example : If your table name is CUSTOMERS. Type your Table name as CUSTOMERS in (sql server) query form and select it. Now pressALT+F1. Your table structure will be displayed completely.

like image 27
desiha Avatar answered Nov 05 '22 04:11

desiha