How do I see the script of a table in SQL Server 2008 Management Studio?

When I right click on the table name I click on select top 1000 rows and it gives me this script

/****** Script for SelectTopNRows command from SSMS  ******/
SELECT TOP 1000 [response_id]
      ,[submitter]
      ,[submitterdept]
      ,[employee]
      ,[employeedept]
      ,[rating1]
      ,[rating2]
      ,[rating3]
      ,[rating4]
      ,[rating5]
      ,[commentpositive]
      ,[commentnegative]
      ,[star]
      ,[commentdate]
      ,[status]
      ,[approvedby]
      ,[approveddate]
      ,[execoffice_status]
      ,[execoffice_approvedby]
      ,[execoffice_date]
  FROM [Intranet].[dbo].[CSEReduxResponses]

How do I see the script of the table? There is nothing I have tried when I right click on the table that i can see the script.


Here's one way:

  • Open SSMS
  • Open Object Explorer (hit F8)
  • Connect to a SQL instance
  • Open "Databases"
  • Open the desired database
  • Open "Tables"
  • Right-click on the desire table
  • In the menu, select "Script table as"
  • In the sub-menu, select "Create to"
  • In the sub-sub-menu, select "New Query Editor Window"
  • This will generate a create script and lod it into its own query window.

    Here's more detail than you wanted:

  • From the SSMS menu, select Tools / Options
  • In the dialog window, select "SQL Server Object Explorer"
  • Select "Scripting"
  • Each of the items in the right-hand pane will control an aspect of how and what objects will be scripted by Object Explorer.


    Your results window isn't sized to where you can see the output. Look towards the bottom of your window, you should see results and messages. Drag it up to display your results. If your results window is completely hidden you can go to "Window" ---> Show Results Pane.


    Go to your SSMS Righ click the Table and follow the path show as below

    在这里输入图像描述

    This will create the script of your table.

    链接地址: http://www.djcxy.com/p/24728.html

    上一篇: 在每个GROUP BY组中选择第一行?

    下一篇: 如何在SQL Server 2008 Management Studio中查看表格的脚本?