Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Strip Non-numeric characters from string function


Sometimes it's necessary to strip non-numeric characters from the string, so you can convert to integer without error. Often it happens when you want to use stored procedure, especially system procedures. The output there can be already with some characters (MB, KB and such), but you want this result to be used for your own purposes as integer or print the result with order by integer part of column. This function is equivalent of Cint or Int in other languages.

You can customize this function by implementing your own rules as far as ASCII characters allowed.

The second script details how it’s used to show all tables with their size-related metrics ordered by Reserved size.

As functions supported only in SQL 2000, this scalar function is to work under SQL 2000 only. 

Total article views: 1126 | Views in the last 30 days: 1
Related Articles

Pass integer array to Code function

How to pass a mutli-valued integer parameter as an array to a VB function


character limitations on sp name, & function name

character limitations on sp name, & function name


Function to count set bits in a signed integer

This function counts the number of 1's in the binary representation of an integer.


Charpad - Character Padding Function

A generic character padding function. Useful for situations where you need fixed width formatting e....


Function to find non-printable characters

The function is used to find non-printable ASCII characters in an input string.


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones