Red Gate forums :: View topic - Add column to an existing table?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Data Generator 1
SQL Data Generator 1 forum

Add column to an existing table?

Search in SQL Data Generator 1 forum
Post new topic   Reply to topic
Jump to:  
Author Message
jbaima



Joined: 14 Jun 2010
Posts: 1

PostPosted: Mon Jun 14, 2010 4:14 pm    Post subject: Add column to an existing table? Reply with quote

I have a table with some real data but I would like to add several new columns to that table. So, can I have the program keep existing columns and then just fill in the new, selected columns?

After a certain point, it is quite inconvenient to have to drop/truncate what is there and completely regenerate the table.

Thanks!

-John
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1112
Location: My desk.

PostPosted: Wed Jun 16, 2010 11:25 am    Post subject: Reply with quote

Hi John,
This feature is something that has been asked for previously, and will hopefully make it in to a future release of the product.

For now, there is a workaround that may be of use to you:

- Add your new column(s)

- Create a copy of the table you are interested in using something along the lines of:

Code:
SELECT *
INTO temptable
FROM sourcetable


- In SQL Data Generator, choose the option to "Use Existing data source" for the table you are working with. Source Type is "SQL Table or View", and the Source is the copy you made (temptable in the above example)

- Expand the table in the tree on the left, and for the new columns, select the generator you wish to use.

- Confirm the other columns are correctly referring to the source temp table.

- With the table itself selected on the left, ensure you have "Same as mapped data" set in the Specify number of rows box.

- You still need to have "Delete data from table before generation" ticked, otherwise you will just get twice the number of records (or it will fail with duplicate keys) and you may also need to temporarily remove foreign key constraints if it warns you the delete could fail.

Hopefully the above will achieve the effect you are after, but if not, please feel free to contact support.

James.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group