Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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)

IsNumber fails cast while IsBigInt passes cast

By William Talada,

When converting varchar data to bigint datatype, you can use IsNumeric() builtin function but it returns true even if a number string contains strange characters. It also does not do range checking. Just run the included script to create the IsBigInt() function in your database. If it returns true, you can be sure the string will cast to bigint.

Total article views: 723 | Views in the last 30 days: 1
 
Tags
bigint    
isnumber    
t-sql    
 
Contribute