Red Gate forums :: View topic - Getting a substring of value in another 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

Getting a substring of value in another column

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



Joined: 29 Jan 2013
Posts: 2

PostPosted: Tue Jan 29, 2013 8:10 pm    Post subject: Getting a substring of value in another column Reply with quote

I am trying to generate a username based on the the first initial of their First Name and their last name. I see how to get their last name $[LastName]. How do I extract the first initial of their first name?
Back to top
View user's profile Send private message
stanori



Joined: 23 Apr 2012
Posts: 84

PostPosted: Wed Jan 30, 2013 11:11 pm    Post subject: Reply with quote

Hi lukemiller,

Thanks for your post. There isnt a way to do this out of the box in SQL Data Generator. You could try writing a Regular Expression using the RegEx generator to try and accomplish this, or create a file containg first letters, and use this file as a generator in conjunction with the RegularExpression. The Last name and first name generators are using files that get installed with SQL Data Generator (first.txt and last.txt). Hope this helps.

Best Regards,
_________________
_________________
Steve Tanori
Product Support
Red Gate Software Ltd.
866-997-0378
Back to top
View user's profile Send private message
nelsont



Joined: 05 Mar 2013
Posts: 1

PostPosted: Tue Mar 05, 2013 10:21 pm    Post subject: SQL Script Reply with quote

Would it be possible to write a SQL script and have it automatically run after the data is generated?

replace username with left(firstname,1)+lastname
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