I would like to be able to copy the definition of a table or its creation script to the clipboard. I have tried this by opening the Tables node in VistaDB Data Builder, right clicking one of my tables, selecting "Copy Table Schema". After doing this I am presented with a dialog box titled "Copy Table Schema - My Table Name. This window does not show me how to get the schema into the clipboard or saved to a file name of my choosing. At the very least I would have thought it would show a script which could be used to create the table in a memo edit box but I see no such data. I see a "Save Table Structure" icon at the top but all that does is close the window giving me no clue as to whether a copy of the table structure was placed somewhere.
Maybe I am missing something here. What do I need to do to get a copy of the table structure create command that can be used to create the table into the clipboard? I am looking for the copy to delivery content such as the following:
CREATE TABLE dbo.Products
(ProductID int PRIMARY KEY NOT NULL,
ProductName varchar(25) NOT NULL,
Price money NULL,
ProductDescription text NULL)
The Copy Table Schema feature copies the schema from an existing table and allows you to create a new table (by changing the table name at the top) with the same schema, optionally after making changes. You'll recognize that same table/column creation GUI is used by the NewTable, Alter Table, and Add New Column menu actions. The floppy-disc icon for Save Table Structure saves (applies) the changes.
Current support for generating creation scripts from existing tables is limited--although that's an area we are looking at improving in the future. There is a feature under SQL Script --> Generate SQL Script which will generate a schema creation script for all tables in the database and save it to a file. You can then open the file with File --> Open SQL Query or with the corresponding toolbar icon (or in another editor) and select the portion you want and copy it into the clipboard--for example, in order to paste it into SSMS to create a matching schema in a SQL Server database.