I have a stored procedure in SQL Server that has two datetime parameters. Crystal doesn't seem to work with them. I've read all kinds of things on the 'Net but have not found a solution yet. If you make the parameters varchar then Crystal reads it as a string and the user doesn't get the calendar thing to choose the dates.
Here's the most recent thing I got from another forum but I don't get any results:
alter PROCEDURE [dbo].[Trans_History3_Crystal_Account_pr]
@Company AS INT
,@Accounts AS VARCHAR(100)
,@AccountingUnit as VARCHAR(100)
,@BegSubAcct as INT
,@EndSubAcct as INT ,
@SDate AS VARCHAR(11)
,@EDate AS VARCHAR(11)
,@LRange as Bit
,@NoBalAct as bit
--1st test to get zero records ddr 9/24/08
--exec Trans_History3_Crystal_Account_pr 3000,'10010,10010','ALL',0,999, '01/01/2007','01/01/07',0,1
--exec Trans_History3_Crystal_Account_pr 9330,'10000,99999','ALL',0,999,'05/01/2008','07/31/2008',1,1
--NOTE: This code is separated by sorting acct_unit, accounts and then by accounts,acct_unit
--Accordingly, you need to change both sets of Crystal code for any enhancements/bugs ddr 8/15/08
AS
----***********NOTES
----used Running Balances code found on the Internet ddr 9/10/08
----This procedure is used to get beginning balance (based on parameters)
----transactions with date range and calculate and ending balance
----It's a basic general ledger for the clients
----************
--
--***LEAVE DECLARED
--PRINT @StartDate
--PRINT @EndDate
DECLARE @StartDate AS DATETIMEDECLARE @EndDate AS DATETIME
set @StartDate = cast (@SDate as datetime)
set @EndDate = cast(@EDate as datetime)
set @SDate = cast (@StartDate as datetime)
set @EDate = cast(@EndDate as datetime)
--SELECT @StartDate AS StartDate, @EndDate AS EndDate, @SDate AS SDATE, @EDate AS EDATE
This is how I'm running it:
--exec Trans_History3_Crystal_Account_pr 9330,'10000,99999','ALL',0,999,'05/01/2008','07/31/2008',1,1
Any help would be greatly appreciated.