SQL SERVER – Validate Field For DATE datatype using function ISDATE()

This article is based on the a question from Jr. Developer at my company. He works with the system, where we import CSV file in our database. One of the fields in the database is DATETIME field. Due to architecture requirement, we insert all the CSV fields in the temp table which has all the fields VARCHAR. We validate all the data first in temp table (check for inconsistency, malicious code, incorrect data type) and if passed validation we insert them in the final table in the database. Let us learn about ISDate function in this blog post.

Read More

SQL SERVER – Result of EXP (Exponential) to the POWER of PI – Functions Explained

SQL Server can do some intense Mathematical calculations. Following are three very basic and very necessary functions. All the three function does not need explanation. I will not introduce their definition but will demonstrate the usage of function. SELECT PI() GO SELECT POWER(2,5) GO SELECT POWER(8,-2) GO SELECT EXP(99) GO…
Read More

SQL SERVER – Repeate String N Times Using String Function REPLICATE

I came across this SQL String Function few days ago while searching for Database Replication. This is T-SQL Function and it repeats the string/character expression N number of times specified in the function. SELECT REPLICATE( ' https://blog.sqlauthority.com/ ' , 9 ) This repeats the string https://blog.sqlauthority.com/ to 9 times in…
Read More