handled it with:
RIGHT('0000' + regionID, 4)
That way, it was always four digits long, with leading zeroes.
"Levenson, Keith" <[EMAIL PROTECTED]>
05/25/2004 12:33 PM
Please respond to sql
To: SQL <[EMAIL PROTECTED]>
cc:
Subject: Preserving leading zeroes
Hi All,
I have company codes that contain leading zeroes. I imported that data
just
fine from DB/2 into nvarchar fields to an SQL2000 table. When I call
these
fields from a stored procedure as a local variable, it automatically trims
off the leading zero. Is there a better data type to use that won't do
this?
I looked into the REPLICATE function, and can probably tack it on like
this:
@myvariable = select REPLICATE('0', 1) + myothervariable as nvarcvhar
but I'd rather do string compares off the "clean" data from the table. Any
suggestions?
Thanks!
/Keith
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
