String Manupulation with test data.

The simplest way to populate your database with test data.

Moderators: David Atkinson, Anu Deshpande, Lionel

String Manupulation with test data.

Postby sdorsett » Tue Aug 26, 2008 6:36 am

I have a table column that contains URLs. In another column in the same table I would like to extract the domain from the URL in the previous column. For example,

URL Domain
http://www.test.com test.com
http://www.abc.com abc.com

How would I go about pulling this off in the Data Generator?
sdorsett
 
Posts: 4
Joined: Tue Aug 26, 2008 6:30 am

Need help

Postby sdorsett » Thu Aug 28, 2008 7:29 am

Any help would be greatly apreciated here. Is there any native functions that support string manipulation. Is the code generator my only option?

To recap,
I want the second column to be a substring of the first column.
sdorsett
 
Posts: 4
Joined: Tue Aug 26, 2008 6:30 am

Postby Linda Hawksworth » Thu Aug 28, 2008 12:24 pm

I don't think any of the generators will do this but I will investigate how it could be done with a custom generator. Please bear with me.
Linda Hawksworth
 
Posts: 192
Joined: Mon Jun 25, 2007 11:32 am

Postby sdorsett » Fri Aug 29, 2008 3:07 pm

For the case provided, yes. Ideally I am looking for a string manipulation code generator.

Here is the scenario, I would like to generate a table of data where the first column is a list of specified URLs. The second column would be just the domain part of the URL in the first column, the third column would be any query information that was a part of the URL.

For example,

Column1 | Column2 | Column3
http://www.test.com/home.asp?id=3 | test.com | ?id=3
http://www.home.com/home.asp?id=1 | home.com | ?id=1
http://www.abcd.com/home.asp?id=4 | abcd.com | ?id=4
http://www.test.com/home.asp?id=5 | test.com | ?id=5
http://www.crazy.com/home.asp?id=6 | crazy.com | ?id=6
sdorsett
 
Posts: 4
Joined: Tue Aug 26, 2008 6:30 am

Postby sdorsett » Thu Sep 11, 2008 7:51 pm

I did find a solution to my problem. Here is what I did.

I was shooting for a generated table that looked like the following.

Image

Here is what the files look like.

Image
Image
Image
Image
Image

I didn’t want to create the ReferrerDomainList and ReferrerURLList. I was hoping to dynamically create the entries via some string manipulation function provided by RedGate. No worries, maybe you can provide this in a future release.

Thanks for your assistance.


Sean Dorsett
http://www.slackytidy.com
L O O S E L Y C O U P L E D & C L E A N C O D E
sdorsett
 
Posts: 4
Joined: Tue Aug 26, 2008 6:30 am


Return to SQL Data Generator 1

Who is online

Users browsing this forum: No registered users and 0 guests