![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
So my question is can I do this by a query or even a series of queries, if so how ? I prefer QBE but Local SQL is fine as well. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
I can think of one way. Create an intermediate table with the other 3 columns, and a UNIQUE_ID (or whatever you want to call it) as an autoinc. Insert the other values via a query. Then in a second query to your actual table, you can do scalar calcs on the autoinc value for each row, which you can treat like a record number. At the end of query 1 you have UNIQUE_ID CLIENT_ID CAMPAIGN_ID Status 1 AAAAA XYS12345 Send Mail 2 AAAAB XYS12345 Send Mail 3 AAAAC XYS12345 Send Mail ... 100000 ZZZZZ XYS12345 Send Mail In a second insert query to your destination, you can perform whatever fixed calc you want on UNIQUE_ID to give it the formatting you want - add a minimum for it, append text, whatever. -- Larry DiGiovanni Digico, Inc IT Consulting and Staffing Solutions www.digicoinc.com Check out www.thedbcommunity.com for Paradox resources |
#5
| |||
| |||
|
|
Leslie Milburn wrote: Keeping it simple for me, lets say I have done the first query and generated the intermediate table as per your example. How would I then transfer the data over and say add the intermediate UNIQUE_ID (1....10000) to the starting value of 'xyz1234'. Is 1234 is to be treated as numeric xyz1235 xyz1236 ... xyz11234 or as an alphanumeric seed: xyz12341 xyz12342 ... xyz123410000 Either way, I'd use SQL. Not sure if QBE will do the implicit typecasting you'd need. SELECT 'xyz' || CAST(1234 + unique_id as CHAR(6)) as unique_id, client_id, campaign_id, Status FROM answer Will give you an answer table with 1234 treated as a numeric seed. Move 1234 into the prefix string xyz if you want it the other way. I forget if that'll leave trailing spaces (char(6)) or not. If it does and you don't want them: SELECT 'xyz' || TRIM(TRAILING ' ' FROM CAST(1234 + unique_id as CHAR(6))) as unique_id, client_id, campaign_id, Status FROM answer -- Larry DiGiovanni Digico, Inc IT Consulting and Staffing Solutions www.digicoinc.com Check out www.thedbcommunity.com for Paradox resources |
#6
| |||
| |||
|
|
Thanks again and also to the others who replied. I'll let you know how it went tomorrow (its midnight here in Australia). |
#7
| |||
| |||
|
|
How come you get to the neat answers before I read the NG ? It's just not fair ! ![]() |

![]() |
| Thread Tools | |
| Display Modes | |
| |