Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Check date as valid date

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-01-03 : 14:19:08
Senthilkumar writes "Check the input date as a valid date or not using user defined functions. Input date format like dd/mm/yyyy ."

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-01-03 : 14:35:11
Can't you use the built-in ISDATE function?

if isdate(@MyDate) = 1
begin ...do something... end





CODO ERGO SUM
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-01-03 : 14:58:57
What do you mean by "input date"? Your stored procedures should accept properly-typed parameters that should be translated to dateTime values by the client providing those values. SQL Server is not designed to be a language that parses and validates user input.



- Jeff
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-01-03 : 20:59:11
The date could be coming from a file instead of a client...

--Jeff Moden
Go to Top of Page
   

- Advertisement -