Entering datetime data into Sql Query Analyzer debug dialog

I am trying to enter a datetime into a stored procedure thru the SQL Query Analyzer Debug Dialog such as 2003-02-01 12:00:00 AM.
When i hit the execute button, i get the following error...
Invalid character value for cast specification

How do i enter datetime values into the Sql Query Analyzer debug window


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

insert tableA values ( '2003-02-01 12:00:00 AM')  
thus make it a string
eddyevationsAuthor Commented:
i am debugging a stored procedure from Sql Query Analyzer...right click on the stored procedure and then select "debug..." from the context sensitive menu...then a dialog will appear which allows you to enter the parameters for the proc...I have had success entering dates alone but when i enter dates and times, it does not work.
ok in that case dont make a string and leave off the AM or PM part (ie use 24 hour clock) then it will work
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

eddyevationsAuthor Commented:
I tried "2004-12-23 14:30" and it did not work
Anthony PerkinsCommented:
Do not use double quotes or single quotes for that matter.  If this is not it than post your stored procedure.

Also, please elaborate on what "did not work".  This is singularly unhelpful. Tell us either:

1. It gave the same error message.
2. It gave another error message, if so what is it.
3. It gave the wrong results, if so what did you get and what was desired.
4. Smoke came out of your monitor.
eddyevationsAuthor Commented:
I did not use any quotes.  I am using quotes here to "quote" my input.  

i entered the following...

2004-12-23 14:30

and it gave me the following error...

[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification
Anthony PerkinsCommented:
Since I was unable to duplicate the problem, I can only assume that the problem lies in the stored procedure (for example you are using smalldatetime instead of datetime), but since you have not posted it, I really cannot help you any further...
-- personally, i hate datetime , especially when inserting from web browser. this one works often for me, but...
dec 23 2004 14:30  

eddyevationsAuthor Commented:
Thanks ill,
But that did not work for me.  I can enter 2004-11-23.  But when i add the time component, id does not like it.  I get the error
[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification

My Stored Proc is...
CREATE  proc PrivProcGetStateDataValueBeforeDate
      @date datetime
as begin
Anthony PerkinsCommented:
That is because you are not including the seconds.  Use:
2004-12-23 14:30:00

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eddyevationsAuthor Commented:
Thanks acperkins,
That was simple :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.