Red Gate forums :: View topic - RegExpGenerator and Insert Table Column
Return to www.red-gate.com RSS Feed Available

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

RegExpGenerator and Insert Table Column

Search in SQL Data Generator 2 forum
Post new topic   Reply to topic
Jump to:  
Author Message
facklec



Joined: 26 Jun 2013
Posts: 3
Location: Olympia, WA

PostPosted: Wed Jun 26, 2013 8:01 pm    Post subject: RegExpGenerator and Insert Table Column Reply with quote

I want to use a RegExp to change a value incrementally everytime another column changes values. Column A (which ends in a digit) repeats for x number of rows. I need Column B to start at some number and increase by 1 for each row until Column A changes values. I thought if I could grab that last digit and increment its value but this is way beyond my skills. Can anyone help me. Is it possible? Or can I only add to the Insert Table Column Value?
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Fri Jun 28, 2013 8:48 am    Post subject: Reply with quote

Natively, SQL Data Generator doesn't support updating one column from a generated value in another column of the same table.

The workaround for this was an (unsupported) third-party add-in for SDG that allowed you to generate the data using a Ruby script. (note: the built-in Python script generator sadly doesn't have this capability).

So you *could* use the Ruby gen to derive values from one column *or* you could use the Python generator on both columns to generate a predictable set of numbers that you know will result in the requirement being filled.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Fri Jun 28, 2013 9:08 am    Post subject: Reply with quote

I think you're after something similar to this: http://www.red-gate.com/MessageBoard/viewtopic.php?t=15979
Back to top
View user's profile Send private message
facklec



Joined: 26 Jun 2013
Posts: 3
Location: Olympia, WA

PostPosted: Wed Jul 10, 2013 5:47 pm    Post subject: One small problem Reply with quote

Brian, thanks, this will definately be helpful in a lot of circumstances only unfortuately in this particular case my TableA PK is not an integer, it's a string with alpha/numeric combination.
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