Getting a substring of value in another column

The simplest way to populate your database with test data.

Getting a substring of value in another column

Postby lukemmiller » Tue Jan 29, 2013 7:10 pm

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?
Posts: 2
Joined: Tue Jan 29, 2013 7:02 pm

Postby stanori » Wed Jan 30, 2013 10:11 pm

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.
Posts: 84
Joined: Mon Apr 23, 2012 12:13 pm

SQL Script

Postby nelsont » Tue Mar 05, 2013 9:21 pm

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
Posts: 1
Joined: Tue Mar 05, 2013 9:16 pm

Return to SQL Data Generator Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests