Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show create table tablename in SQL Server

Tags:

In MySQL it is possible to do show create table tablename

What is the SQL Server equivalent?

like image 433
Alex Gordon Avatar asked Aug 19 '10 23:08

Alex Gordon


People also ask

How we can see the created table in SQL?

A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database. You can add SQL statements and functions to a view and present the data as if the data were coming from one single table. A view is created with the CREATE VIEW statement.

How can you tell when a table was created in SQL Server?

Right-click the Products table in SQL Server Object Explorer, and select View Data. The Data Editor launches. Notice the rows we added to the table in previous procedures. Right-click the Fruits table in SQL Server Object Explorer, and select View Data.

How can I get table description in SQL Server?

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

How do you get DDL of a table in SQL Server?

To generate the table DDL via query, you can use show create command. SHOW CREATE TABLE yourTableName; The above syntax is MySQL specific. Suppose, we have a table with the name 'DDLOfTableStudent'.


2 Answers

In SSMS, right-click on the table node and "Script Table As" / "Create".

There is no built in 'script this table' T-SQL.

sp_help 'tablename' gives useful table information if that'd do.

like image 163
Will A Avatar answered Nov 05 '22 08:11

Will A


One that might be close:

exec sp_columns YourTableName 
like image 25
Danniel Little Avatar answered Nov 05 '22 06:11

Danniel Little