February 19, 2010 at 9:22 am
I know its a simple questions . i am breaking me head on this .
Msg 201, Level 16, State 4, Procedure SP_SOAC_REPORT_SUMMARY, Line 0
Procedure or function 'SP_SOAC_REPORT_SUMMARY' expects parameter '@TODT', which was not supplied.
exec SP_SOAC_REPORT_SUMMARY '@FROMDT=01/01/2010;TODT=01/02/2010'
please let me know what exactly the error is
February 19, 2010 at 9:29 am
Try:
exec SP_SOAC_REPORT_SUMMARY '@FROMDT=01/01/2010',@TODT='01/02/2010'
February 19, 2010 at 9:34 am
Now i get this error
Msg 241, Level 16, State 1, Procedure SP_SOAC_REPORT_SUMMARY, Line 7
Conversion failed when converting datetime from character string.
February 19, 2010 at 9:53 am
My bad. Try:
exec SP_SOAC_REPORT_SUMMARY @FROMDT='01/01/2010',@TODT='01/02/2010'
February 19, 2010 at 9:59 am
Nikki123,
Your original post was passing in an anonymous string value as the parameter with your param data as part of the string. The parameters each need to be passed in individually, separated by commas. If the procedure only has two params, you can eliminate the "@paramname = " part as long as you pass them in the order that they are defined. Your exception reflected this. There was no parameter name specified so it assumed that the string was the first parameter and that the second non-optional parameter was not being passed in. Had your second parameter had a default value assigned in the definition of the procedure, you would have received the conversion exception that you got later.
Tim Januario
February 21, 2010 at 4:15 am
nikki123 (2/19/2010)
I know its a simple questions . i am breaking me head on this .Msg 201, Level 16, State 4, Procedure SP_SOAC_REPORT_SUMMARY, Line 0
Procedure or function 'SP_SOAC_REPORT_SUMMARY' expects parameter '@TODT', which was not supplied.
exec SP_SOAC_REPORT_SUMMARY '@FROMDT=01/01/2010;TODT=01/02/2010'
please let me know what exactly the error is
I would do some thing like this for dates always
yyy-mm-dd this seems to work for me
like when you pass in the data make sure you passin in the order
exec SP_SOAC_REPORT_SUMMARY '@FROMDT=2010-01-01;TODT=2010-01-02'
This eliminates your issue of date formats for a long time.
Regards
Vinay
February 21, 2010 at 9:49 am
bhushanvinay (2/21/2010)
I would do some thing like this for dates alwaysyyy-mm-dd this seems to work for me
like when you pass in the data make sure you passin in the order
exec SP_SOAC_REPORT_SUMMARY '@FROMDT=2010-01-01;TODT=2010-01-02'
This eliminates your issue of date formats for a long time.
There are many acceptable string date formats. yyy-mm-dd is not one of them. 'yyyy-mm-dd' is, also 'yyyymmdd'.
Specifying the parameter name is good practice. Relying on the order of the parameters is not a good example of defensive programming.
Your posted 'solution' above (the 'exec' statement) is incorrect.
A perfect answer was previously submitted by Steve Cullen.
Paul
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply