I have to split a "fixed" string (@subscriberData nvarchar(305)) into a tableDeclare @subscriber table ( groupNum char(5), location char(5), lastname1 nvarchar(12), lastname2 nvarchar(12), firstname nvarchar(12), initial char(1), birthdate char(8), sex char(1), relation char(1), coverage char(1), address1 nvarchar(36), address2 nvarchar(36), city nvarchar(25), state char(2), zipCode nvarchar(9), dateHired char(8), status char(1), otherDental char(1), cobraMonths char(2), cobraExp char(8), cobraTerm char(8), actionCode char(1), actEffecDate char(8), regionCode char(1), municipality char(4), indivSS char(9), indivSufix char(2), COB3 char(1), primaryCenter nvarchar(10), HICode nvarchar(12), ODSIfamilyID nvarchar(11), alternateID nvarchar(25), msg nvarchar(15), contract nvarchar(13) )
but some transactions won't have all the fields though but existing fields must be in a specific possitionI'm thinking to do thisset @subscriberData= @subscriberData+ replicate(' ',305 -len(@subscriberData))Insert into @subscriberleft(@subscriberData,5),subString(@subscriberData,6,5),subString(@subscriberData,11,12),subString(@subscriberData,24,12),subString(@subscriberData,37,12),...But I would like to change the string to a pipe delimited string and do something as I would do it in VBmyArray = split(subscriberData,"|")rec.addNewFor i = 0 to rec.recordCount-1 rec.Fields(i) = myArray(i)next
Any suggestions??I have two other strings that will be in other two tables with fewer fields but with the possibility of having more than one recordBy the way is there a limit for Stored procedures?*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*A candle loses nothing by lighting another candle