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

By RAD,

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: 1112 | Views in the last 30 days: 5
 
Related Articles
FORUM

Pass integer array to Code function

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

FORUM

character limitations on sp name, & function name

character limitations on sp name, & function name

SCRIPT

Charpad - Character Padding Function

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

SCRIPT

Function to find non-printable characters

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

SCRIPT

Function to Expand Tab Characters

A function to replace tab characters with the correct number of spaces to align the text as original...

Tags
 
Contribute

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
Editor, SQLServerCentral.com

Already a member? Jump in:

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