Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stripping Leading Zeros from Varchar during select
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00721526
Message ID:
00721542
Views:
9
This message has been marked as a message which has helped to the initial question of the thread.
You can use CAST function
DECLARE @str varchar(16)
SET @str = '0000000000458273'
SELECT CAST(CAST(@str AS numeric(16)) AS VARCHAR(16))
>I have a table that was and is populated from another system. One of the id fields is a 15 character field, that gets put into our system with leading zero's. So far, only the right 6 digits are populated, the rest are all zero's. My question is, is there a way during a select statement to remove the leading chars, maybe using a UDF? We display this field in many places during our application both on screen and in reports. Thanks for any suggestions and ideas.
>
>Kirk
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform