Problems with sql query "declare" error

Stimulsoft Ultimate discussion
Post Reply
David334
Posts: 29
Joined: Tue Jul 16, 2019 6:45 pm

Problems with sql query "declare" error

Post by David334 »

Hi, I am not sure which version software I am using, its been bundled with the E2 Shoptech software. I am trying to modify a report and I need to find a way to calculate a date range.
I tried using this query which will return the correct values when ran in sql manager:

Code: Select all

declare @value as decimal(18,5)
declare @payroll_start as date
declare @payroll_stop as date
set @payroll_stop = GetDate()
Set @value = (DatePart(dy, @payroll_stop) - (12.0 - DatePart(dw,1))) / 14.0
IF @value % 1 <> 0 
Begin
	set @payroll_start = @payroll_stop
	While @value % 1 <> 0
	Begin
		Set @payroll_start = Dateadd(Day, -1, @payroll_start)
		Set @value = (DatePart(dy, @payroll_start) - (12.0 - DatePart(dw,1))) / 14.0
	End
	set @payroll_start = DateAdd(Day, 1, @payroll_start)
End 
Else 
Begin
	set @payroll_start = DateAdd(Day, -13, @payroll_stop) 
End

Select @payroll_start as [Period Start], @payroll_stop as [Period Stop]
It basically returns a date range to print out only those days for login info.

The problem I have is I always get an error "Incorrect syntax near the word 'declare' "
I have tried to read the documentation, but its lack of explanation makes it hard to figure this out.
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Problems with sql query "declare" error

Post by Lech Kulikowski »

Hello,

Your query is working in or product. Please send your request to the E2 Shoptech software developers.

Thank you.
Attachments
Annotation 2019-07-16 235333.jpg
Annotation 2019-07-16 235333.jpg (163.44 KiB) Viewed 1835 times
David334
Posts: 29
Joined: Tue Jul 16, 2019 6:45 pm

Re: Problems with sql query "declare" error

Post by David334 »

I was afraid of that. Sadly if there is a problem with the way they implement this software, there will be no resolution as they will place blame on Stimulsoft , lol.
I was able to do a workaround using no variables.
Looking at the current software on Stimulsoft's site vs what E2 has implemented, I wonder if they are using some extremely old version?

Anyways, thanks for trying to assist.
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Re: Problems with sql query "declare" error

Post by Andrew »

Hello,

I think yes, they use quite old version of Stimulsoft. You should insist on tech support from their side because this is their responsibility.

Thank you.
Post Reply