Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Expression string Date incorrect

Status
Not open for further replies.

mdahlen

Technical User
Feb 26, 2003
6
US
I am converting a string to a date field in an SQL expression and get the error 'failed to retrieve data from database - not a valid date'. The date entered was 10/50/2011. How can I determine if a string date is valid before I execute the rest of the SQL expression?
 
Hi,
10/50/2011 is not a valid date in any format..Was this a typo?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
yes---it was entered incorrectly by the user --it is a freee text field. I would like to eliminate these ridiculous dates before executing the rest of the SQL expression
 
Hi,
Unsolicited adfvice follows
Free text fields are not usually a good idea when allowing access to a database since a clever user could use SQL Injection methods
( )
to manipulate the database data without DBA knowledge or permission.
End of advice

You could set a text mask on the field and or build in some check for validity before passing it to the expression.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top