Hi.
I have the following 2 input tables:
1. tblTempValue has 2 fields: Value (TEXT) and AssetID (BIGINT(20)) and holds the following values:
Value AssetID
1,3,10 90
4 91
8 92
2 93
5 95
2. My lookup tblTextDOB has 2 fields: RaceNumber (VARCHAR(20)) and DateOfBirth (VARCHAR(10)) and holds 100 records (up to RaceNumber 100):
RaceNumber DateOfBirth
1 20/10/1996
2 01/05/1998
3 10/11/1997
2 03/05/1995
4 11/01/1994
5 23/02/1998
6 09/12/1995
7 21/05/1996
8 13/10/1999
9 16/05/1994
10 06/04/1998
--- ---
--- ---
--- ---
100 13/05/1996
3. I have 1 output table – tblTempDOB has 4 fields AttributeID BIGINT(20), RaceNumber (VARCHAR(20)), DOBAssetID BIGINT(20), DateOfBirth (VARCHAR(20)).
4. I run this code. I only want to insert a value on tblTempDOB for each occurrence of Value on tblTempValue:
insert
into tblTempDOB
(AttributeID , RaceNumber , DOBAssetID , DateOfBirth)
Select 42,
RaceNumber,
AssetID ,
DateOfBirth
From tblTempValue
Inner Join tblTextDOB
On Instr(',' + RaceNumber + ',', ',' + Value + ',') > 0
4. I want my output in tblTempDOB to be:
AttributeID RaceNumber DOBAssetID DateOfbirth
42 1 90 20/10/1996
42 3 90 10/11/1997
42 10 90 01/04/1998
42 4 91 11/01/1994
42 8 92 13/10/1999
42 2 93 01/05/1998
42 5 95 23/02/1998
5. What’s happening is that the code is adding a record to tblTempDOB for every record on my lookup table tlbTextDOB. I know this is because of the JOIN but I can’t see what. I am also getting a Truncated incorrect DOUBLE value: ',' - error when running the code.
I will really appreciate any help you can give as it’s getting critical.
Thank you.
Saners.
I have the following 2 input tables:
1. tblTempValue has 2 fields: Value (TEXT) and AssetID (BIGINT(20)) and holds the following values:
Value AssetID
1,3,10 90
4 91
8 92
2 93
5 95
2. My lookup tblTextDOB has 2 fields: RaceNumber (VARCHAR(20)) and DateOfBirth (VARCHAR(10)) and holds 100 records (up to RaceNumber 100):
RaceNumber DateOfBirth
1 20/10/1996
2 01/05/1998
3 10/11/1997
2 03/05/1995
4 11/01/1994
5 23/02/1998
6 09/12/1995
7 21/05/1996
8 13/10/1999
9 16/05/1994
10 06/04/1998
--- ---
--- ---
--- ---
100 13/05/1996
3. I have 1 output table – tblTempDOB has 4 fields AttributeID BIGINT(20), RaceNumber (VARCHAR(20)), DOBAssetID BIGINT(20), DateOfBirth (VARCHAR(20)).
4. I run this code. I only want to insert a value on tblTempDOB for each occurrence of Value on tblTempValue:
insert
into tblTempDOB
(AttributeID , RaceNumber , DOBAssetID , DateOfBirth)
Select 42,
RaceNumber,
AssetID ,
DateOfBirth
From tblTempValue
Inner Join tblTextDOB
On Instr(',' + RaceNumber + ',', ',' + Value + ',') > 0
4. I want my output in tblTempDOB to be:
AttributeID RaceNumber DOBAssetID DateOfbirth
42 1 90 20/10/1996
42 3 90 10/11/1997
42 10 90 01/04/1998
42 4 91 11/01/1994
42 8 92 13/10/1999
42 2 93 01/05/1998
42 5 95 23/02/1998
5. What’s happening is that the code is adding a record to tblTempDOB for every record on my lookup table tlbTextDOB. I know this is because of the JOIN but I can’t see what. I am also getting a Truncated incorrect DOUBLE value: ',' - error when running the code.
I will really appreciate any help you can give as it’s getting critical.
Thank you.
Saners.