Quantcast
Channel: Date Conversion Issue
Viewing all articles
Browse latest Browse all 4

Date Conversion Issue

$
0
0

SELECT CONVERT(datetime2,'31-08-2018',110)

The above code cannot  convert and giving the error:Conversion failed when converting date and/or time from character string   

While

SELECT  CONVERT(datetime2,'08-31-2018',110) can easily convert to Datetime

Why it is necessary to give date in 'mm-dd-yyyy' format?

This issue i am facing, as i have scenario where I am getting date data in varchar type in Staging table from where i have to load data into application tables and convert date to datetime format,

I greatly appreciate for your help.  


Pankaj


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images