Validating the Data Type in a T-SQL Query

Validating the Data Type in a T-SQL Query

Using the ISNUMERIC() and ISDATE() functions, you can check the required column’s data type validity. If the column passes the data type validity check, it will return a 1. If it fails, it will return a 0.

Example:

 select * from MyTableCompanyID   MyValue----------- -------1           201           101           401           AB(4 row(s) affected)select * from MyTable where ISNUMERIC(MyValue)=1CompanyID   MyValue----------- -------1           201           101           40(3 row(s) affected)select * from MyTable where ISNUMERIC(MyValue)=0CompanyID   MyValue----------- -------1           AB(1 row(s) affected)
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular