Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Best equivalent for IsInteger in SQL Server

Late entry that handles negative

ISNUMERIC(zipcode + '.0e0') --integer
ISNUMERIC(zipcode + 'e0')  --decimal

For more see this


1 approach is

zipcode NOT LIKE '%[^0-9]%'

Double negatives, got to love 'em!


If SQL Server 2005+, I'd enable CLR and create the function to support regexes. For SQL Server 2000, see this article for creating a UDF to do the same thing.

Then I'd use the regex: ^\d{5}$

Tags:

Sql

Sql Server

Tsql

Regex

Related

How to Domainkeys/DKIM email signing using the C# SMTP client? What's the difference between xsd:include and xsd:import? Round double in two decimal places in C#? numpy: extending arrays along a new axis? Is there such a thing as a catch-all key for a javascript object? Solr and facet search Set properties of a class only through constructor What is the proper way to comment functions in Python? PHPUnit Mock Objects and Static Methods How to check whether string might be type-cast to float in Python? Appending to an existing string database vs. flat files

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy