-3

I want to execute DESCRIBE query to view database table, but i am not able to as it shows error 'Incorrect syntax the keyword DESC'

Query :

DESC 'table-name'

  • What does a DESCRIBE query mean? Show us your query. – Denis Rubashkin Jan 11 at 8:45
  • 5
    You cannot use Oracle commands on SQL Server and hope they will work – sepupic Jan 11 at 8:45
  • Part of the reason for the downvotes is that you do not appear to have made basics searches for your answer. Instead, you could improve the question by restating as how do you describe an object in SQL Server. you’re familiar with the Oracle syntax of DESCRIBE and tried that but of course it doesn’t work. How can this be accomplished in SQL Server? – clifton_h Jan 11 at 14:48
2

You should use sp_help to get what you want. This is SQL Server, not Oracle.

use yourDB;
exec sp_help 'yourTable';

sp_help (Transact-SQL)

Reports information about a database object (any object listed in the sys.sysobjects compatibility view), a user-defined data type, or a data type.

This sp only reads table metadata, it does not modify anything.

  • I did found this possible solution but i am afraid tha EXEC command will execute procedure calls and do some modification. – Darshana Jan 11 at 8:52
  • So in your opinion any stored procedure must MODIFY something??? This is wrong, any piece of code can be written as sp, for example CREATE DBO.SP_HI AS SELECT 'HI!' – sepupic Jan 11 at 8:56
  • @Darshana you would greatly Benefit by checking out articles that highlight high-level differences between Oracle and SQL server such as the one from TechDifferences – clifton_h Jan 11 at 14:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.