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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates as Input Parameters

Status
Not open for further replies.
Jan 3, 2001
66
US
I know this must be simple but I have yet to figure it out.

What does the input parameter have to look like for a DateTime variable?

I have a very simple test:
Create PROCEDURE DateTest @MyDate DateTime
AS
Select @MyDate

By going to the Debug feature in the Query Analyzer and typing '01/01/2002', I get the following error message:

[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification

I need to know just what to enter in the Sproc as well as the input variable.

Thank you,

Carolyn

 
I ran your test procedure and it worked fine for me when I executed it. I typed:

Exec DateTest '01/01/2002'

Only thing I could think of is maybe you accidentally typed a letter O instead of a zero?
 
SQLSister,

You are right. It works from the Query Analyzer command line. However, it does not work if I try to use the Debug feature by typing in the date.

Thank you for your response.

Carolyn
 
In 8.0, if you use the YYYY-MM-DD format, it should let you debug using a date input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top