eselhassan
Programmer
My table has the field (PID varchar 17) either 13 or 17 character records. I would like to use the logic below to construct a new table with two fields (CODE varchar 13) and (CODEKEY varchar 17)
IF len(PID) = 13 Then insert into iTable
ESLE
IF len(PID) = 17 Then
1. insert the first 9 characters [iFisrt9]
2. subtract the next 4 characters [iNext4] from the last 4 characters [iLastt4] to get a iCount
3. increment [iFirst9]+[[iNext4] by 1 based of the iCount.
4. insert into same iTable
Example: The record in source table
PID
06029202400250029
Resulting record in new table is
CODE CODEKEY
0602920240025 06029202400250029
0602920240026 06029202400250029
0602920240027 06029202400250029
0602920240028 06029202400250029
0602920240029 06029202400250029
Thanks much for any code to start with
IF len(PID) = 13 Then insert into iTable
ESLE
IF len(PID) = 17 Then
1. insert the first 9 characters [iFisrt9]
2. subtract the next 4 characters [iNext4] from the last 4 characters [iLastt4] to get a iCount
3. increment [iFirst9]+[[iNext4] by 1 based of the iCount.
4. insert into same iTable
Example: The record in source table
PID
06029202400250029
Resulting record in new table is
CODE CODEKEY
0602920240025 06029202400250029
0602920240026 06029202400250029
0602920240027 06029202400250029
0602920240028 06029202400250029
0602920240029 06029202400250029
Thanks much for any code to start with