ShuaibV (7/10/2013)
HelloCan someone please share if there are any functions or code to validate the Date in different format settings?
Ex:
----
If I enter the value "9999", the function should validate against the Date Formats ("MM/DD/YYYY", "DD-MMM-YYYY") and return 0, because 9999 is not a valid Date
If I enter the value "01-Jan-9999", the function should validate against the Date Formats ("MM/DD/YYYY", "DD-MMM-YYYY") and return 1.
Also is there any common function available to use for similar kind of different requirements?
Thanks
Shuaib
I think you should leave the validation to the front end. If you store your data as a datetime datatype this is not an issue.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/