-
Formatting a String
I am trying to remove the leading zeros on a string ex.(003456, 045672) in
a stored procedure. At this point i am not sure exactly how to go about doing
this. Does anyone have any suggestions.
-
Re: Formatting a String
Hi Jim,
You could do it using a loop and the string functions CHAR, LEN and SUBSTRING
but you would need a cursor and the performance would be bad.
I am not sure how you would do it in a regular SELECT statement.
HTH,
Michael Tzoanos
"Jim Milam" <jim_milam@questnetx.org> wrote:
>
>I am trying to remove the leading zeros on a string ex.(003456, 045672)
in
>a stored procedure. At this point i am not sure exactly how to go about
doing
>this. Does anyone have any suggestions.
-
Re: Formatting a String
Jim,
I meant CHARINDEX, not CHAR for the string function.
"Michael Tzoanos" <mtzoanos@hotmail.com> wrote:
>
>Hi Jim,
>
>You could do it using a loop and the string functions CHAR, LEN and SUBSTRING
>but you would need a cursor and the performance would be bad.
>
>I am not sure how you would do it in a regular SELECT statement.
>
>HTH,
>
>Michael Tzoanos
>
>"Jim Milam" <jim_milam@questnetx.org> wrote:
>>
>>I am trying to remove the leading zeros on a string ex.(003456, 045672)
>in
>>a stored procedure. At this point i am not sure exactly how to go about
>doing
>>this. Does anyone have any suggestions.
>
-
Re: Formatting a String
Depending upon the number, you may be able to cast it to an integer and then
back to a string.
That would remove leading zeroes. However, if the string would contain a
number too large to be considered an integer, it wouldn't work.
"Jim Milam" <jim_milam@questnetx.org> wrote:
>
>I am trying to remove the leading zeros on a string ex.(003456, 045672)
in
>a stored procedure. At this point i am not sure exactly how to go about
doing
>this. Does anyone have any suggestions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks