How to check if a given date is in yyyymmdd format sql server -


i spent quit long time , not figure out how can check if given date in yyyymmdd format. can suggest me simple way can achieved in sql

thanks.

once updated sql server 2012 can use try_convert or try_cast test strings.

by using try_convert(date, mycolumn, 112) ether values or nulls when conversion failed because string yyyyddmm format.

for sql server before 2012 best thing can wrap convert(date, mycolumn, 112) inside of try catch. catch errors every time try convert string not in correct format not give null results try_convert in 2012 will.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -