[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Execute Stored Procedure with date variable

Posted on 2011-04-19
Medium Priority
Last Modified: 2012-05-11
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?

Question by:Madsing
LVL 32

Accepted Solution

Ephraim Wangoya earned 1000 total points
ID: 35426929

Input the date as '2010-12-31'

Or use new query and execute as

EXECUTE CustomerWebServiceGetByDate '2010-12-31'

Author Comment

ID: 35426953
Year, now it seems so obvious :-D
Thanks a bunch!  

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question