September 18, 2009 at 9:10 am
I pass 'NA' value to @P_COB1 string parameter.
In my DataSet I have this code:
declare @COB1 smalldatetime
declare @index varchar(15)
--Stale.rdl will not pass any COB parameter
if @P_COB1 = 'NA'
begin
select @COB1 = MAX(COB) from BondSpread
end
else
begin
select @COB1 = convert(smalldatetime,@P_COB1)
end
The report fails with this error:
Syntax error converting character string to smalldatetime data type
September 18, 2009 at 9:23 am
print @p_cob1 in the procedure without the IF/ELSE. I wonder if it's not quite what you think, some other syntax issue.
September 18, 2009 at 9:41 am
I can't do PRINT. I'm in Visual Studio Report Designer.
I did SELECT @P_COB1 and disabled the rest of SQL.
The result is 'NA'.
Dataset runs OK.
Preview also throws an error when 'NA' @P_COB1 is selected:
Query execution failed fro data set 'CUSIP_Chart_DataSet'.
Must declare the variable '@P_COB1'.
Incorrect syntax near the keyword 'else'.
Must declare the variable '@P_COB1'
The problem I think is that it ignores "if @P_COB1='NA'" part and tries to execute
ELSE block which it shouldn't.
September 18, 2009 at 10:21 am
Resolved!
I refreshed everything I could. Dataset, fields, parameters, etc.
and it started to work.
Anyway,
Thank you very much Steve.
September 18, 2009 at 10:28 am
The designer might be caching something. Interesting that a refresh worked.
Glad you're moving forward. I'll remember to ask the next person about the designer and refreshing things.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply