• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 750
  • Last Modified:

Execute Stored Procedure with date variable

Hello Folks,

I have created a Stored Procedure in MS Management Studio in a MS SQL Server 2008. The SP required a input parameter called @InputDate.
The input date is defined as:

@InputDate as datetime = '1753-01-01 00:00:000'

When I right-click the SP and click Execute Stored Procedure Studio Management gives me:

 Screen shot from Mangament Studio
When I click OK it gives me the following error message:

Msg 8114, Level 16, State 5, Procedure CustomerWebServiceGetByDate, Line 0
Error converting data type nvarchar to datetime.

(1 row(s) affected)

So I know that I don't parse the correct value.
Can somebody please help me with the correct value to parse?

1 Solution
Ephraim WangoyaCommented:

Input the date as '2010-12-31'

Or use new query and execute as

EXECUTE CustomerWebServiceGetByDate '2010-12-31'
MadsingAuthor Commented:
Year, now it seems so obvious :-D
Thanks a bunch!  
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now