February 4, 2004 at 8:31 am
Hello everyone,
I did some extensive research on this subject and came up with nothing. Is there a way in SQL Server to zero supress numbers?
For example, the output should look like this 3942 instead of 000000003942.
Any ideas?
Thank you,
Pete ![]()
Peter M. Florenzano
Database Administrator
February 4, 2004 at 8:52 am
If you always have only leading 0s you can use something like
select cast('000000003942' as int)
-----------
3942
(1 row(s) affected)
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
February 4, 2004 at 10:07 am
If there is more to the value so you cannot depend on it being INT, BIGINT, etc. You could do something like
select REPLACE( LTRIM( RTRIM( REPLACE( ErrMessage, '0', ' ' ) ) ), ' ', '0' ) ![]()
Guarddata-
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply