For example, I have a column of data in this form:
086903426,01,085,K8010,H03,1 the column name is IDENTIFICATION, I want to take the part before the the first column to say A1 of the second table, the following part which is length 2 i.e. 01 to A2 etc.
This is the script:
SELECT SUBSTRING(INDENTIFICATION,1, PATINDEX('%,%',IDENTIFICATION)-1) AS A1 this works fine cos it takes the 9 digits i.e. 08903426 but this one below complians of the invalid length blah blah
SELECT SUBSTRING(INDENTIFICATION,11, PATINDEX('%,%',IDENTIFICATION)-8) AS A2, I want this to extract only 01 and put it in A2
I hope it explains all.
Ta!