sqlsql-serversql-server-2012-express

How to view query that was used to create a table?


I create about 15 tables and create relationships and constraints among them using Wizard in SQL Server 2012 express

Now i want to see the query that is used to create those tables including relationships and constraints. Can u provide help?

Thank you.


Solution

    1. Connect to your database using SQL Server Manager Studio
    2. Right-click the table or the view in the Object Explorer panel
    3. From the context menu choose Script Table as.../CREATE to.../< SomeDestination >
    4. Choose a destination (a file, the clip board, etc.)

    Screenshot

    This would give you access to the DDL SQL that can be used to create this table.