|
|
submitted by
xtremebiz
3 months, 6 days ago
codeforeternity.com — I recently had to write a T-SQL function which cleans up all non numeric characters from a varchar variable and returns the int value of the remaining numeric characters. If no numeric characters exist, the function should return zero. I thought it would be nice to share this with you and I hope you find this useful ;-) Expected output of the function:
PRINT dbo.GetIntFromVarchar('R1A2J3') -- returns 123
PRINT dbo.GetIntFromVarchar('COOL456CODER') -- returns 456
PRINT dbo.GetIntFromVarchar('789') -- returns 789
PRINT dbo.GetIntFromVarchar('GEEK') -- returns 0
|
|
tags:
Database | tag it
Everyones tags: | Your tags: | |
|
|
|
Add a live kick counter to your blog >>
You can even customize the image by choosing your own colors, and then clicking
the button below to update the preview and the html code:
Simply copy and paste this HTML into your blog post.
Users who kicked this story:
No comments so far
|