Whats wrong in the syntax ?
hi !
I have the following query in the query designer of a report :
Exec [dbo].[Email Reports] Convert(smalldatetime,@StartDate), Convert(smalldatetime,@EndDate), @Type
But when executing its throwing error like 'Incorect syntax near 'Convert''
if known plz let me know .!--------------------------- Radhai Krish | Golden Age is no more far | --------------------------
July 3rd, 2011 2:23am
Two possibilities:
Is the stored procedure expecting three parameters? Is the name of the stored procedure correct? (Does it really have aspace in it?)
If this post, or another, answers your question, please click the 'Mark as answer' button so others with the same problem can find a solution more easily.
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2011 4:11am
hi any one plz reply !!!
THe following too showing error
Exec [dbo].[Email Reports] GetDate(),GetDate(),'All'
Incorrect syntax near ')'.
The Date params are declared as Varchar(20)
any help plz !!
--------------------------- Radhai Krish | Golden Age is no more far | --------------------------
July 3rd, 2011 4:11am
you cannot pass an Expression as a parameter to a procedure. It has to be either passed as a Value or assigned to a variable and then be passed.
Declare @dt1 datetime
Declare @dt2 datetime
set @dt1=getdate()
set @dt2=getdate()
Exec [dbo].[Email Reports] @dt1,@dt2,'All'
refer
http://msdn.microsoft.com/en-us/library/ms187926.aspx
"You cannot specify a function name as a parameter default value or as the value passed to a parameter when executing
a procedure."
Spandan
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2011 4:57am


