I have a char(12) field that was loaded like '000000000101' I need to change the data to be ' 101'. Is there a way to do this and preserve the number and keep the leading spaces?
Thanks
There are several ways to do this in SQL . This may be the simplest. Simply converet the column to integer and back to a 12 character string.
Select
col1,
str(cast(Col1 as int),12,0) As NewCol1
from MyTable
Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.