Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Date parameter returns invalid argument

Author  Topic 

omega1983
Starting Member

40 Posts

Posted - 2009-09-18 : 17:46:09
I prepared the following as a stored procedure using a date parameter. I then pass it over to a crystal report. When I try and open the report in crystal 2008 it prompts me the the @GifteffdatBegin and @GifteffdatEnd date as it should. It prompts me to insert the date as follows mm/dd/yyyy 00:00:00:00 or datetime format. When I do this I get an invalid argument message. This leads me to conclude that I hav done something wrong in coding on the sql procedure side. Please look at the code and tell me if there are errors that would cause this issue

ALTER PROCEDURE [dbo].[NGP_Parameter]

-- Add the parameters for the stored procedure here
@GifteffdatBegin datetime,--beginning date
@GifteffdatEnd datetime --ending date
AS

SELECT giftkey,giftid,gifteffdat
FROM gift_table
WHERE gifttype = 'a'
AND gifteffdat">= @GifteffdatBegin
AND gifteffdat"<=@GifteffdatEnd

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2009-09-18 : 18:49:26
A few quick questions:
1) What are the two double quotes in the where clause?
2) Can we assume that giftEffDat is a datetime?
3) Do you get an error if you run the stored procedure outside of the Crystal report environment?

=======================================
Men build too many walls and not enough bridges. -Isaac Newton, philosopher and mathematician (1642-1727)
Go to Top of Page

omega1983
Starting Member

40 Posts

Posted - 2009-09-20 : 20:05:27
1. I took the quotes out
2. gifteffdat is a datetime
3. Can I run this in query analyzer if so how would I reflect the dates
Go to Top of Page
   

- Advertisement -