revisiting a script I am working on, Script works brilliantly, except that I need help on fixing the length of 2 text fields to be required lengths of 30 and 15, respectively. Ideally, I am attempting to create and export from SQL fixed length records. Please advise
The code used in attempting to force the length are as follows:
case when len(@Title)>=30 THEN left(@Title,30) ELSE (@Title+ space(30-len(@Title))) END +
case when len(@AllAuthors)>=15 THEN left(@AllAuthors,15) ELSE (@AllAuthors+ space(15-len(@AllAuthors))) END
Current output results:
1436450232Rio de Janeiro 3Fallon, SteveLPlanet01499TVLTP0901
178645092XSouth Africa Lesotho & SwazilaDoggett, ScottLPlanet02499TVLTP0102
186450322XSouth Africa Lesotho & SwazilaRichmond, SimonLPlanet02499TVLTP0102
Required/Desired Output:
1436450232Rio de Janeiro 3 Fallon, Steve LPlanet01499TVLTP0901
1864503076South Africa Lesotho & SwazilaDoggett, Scott LPlanet02499TVLTP0102
186450322XSouth Africa Lesotho & SwazilaRichmond, SimonLPlanet02499TVLTP0102
Thanks alot for your help.
Kathy
When you dig another out of their troubles, you find a place to bury your own.—Anonymous
The person who says it can't be done shouldn't interrupt the person who is doing it.—Chinese Proverb
The code used in attempting to force the length are as follows:
case when len(@Title)>=30 THEN left(@Title,30) ELSE (@Title+ space(30-len(@Title))) END +
case when len(@AllAuthors)>=15 THEN left(@AllAuthors,15) ELSE (@AllAuthors+ space(15-len(@AllAuthors))) END
Current output results:
1436450232Rio de Janeiro 3Fallon, SteveLPlanet01499TVLTP0901
178645092XSouth Africa Lesotho & SwazilaDoggett, ScottLPlanet02499TVLTP0102
186450322XSouth Africa Lesotho & SwazilaRichmond, SimonLPlanet02499TVLTP0102
Required/Desired Output:
1436450232Rio de Janeiro 3 Fallon, Steve LPlanet01499TVLTP0901
1864503076South Africa Lesotho & SwazilaDoggett, Scott LPlanet02499TVLTP0102
186450322XSouth Africa Lesotho & SwazilaRichmond, SimonLPlanet02499TVLTP0102
Thanks alot for your help.
Kathy
When you dig another out of their troubles, you find a place to bury your own.—Anonymous
The person who says it can't be done shouldn't interrupt the person who is doing it.—Chinese Proverb