Wednesday, March 7, 2012

re-arrange name data

i'm attempting to make a DTS package that will export to a csv each day. my problem is figuring out how to change a name field that stores the data as the following format:

First Middle Last

into

Last, First Middle in the outputted .csv file

thanks in advance.

-csubstring(fld,len(fld) - charindex(' ',reverse(fld)),len(fld))
+ ', ' + left(fld,len(fld)-charindex(' ',reverse(fld)))

The numbers will be a bit wrong but you can fix that.

No comments:

Post a Comment