on 08-03-2006 8:58 AM
Dear expert,
When i paste the following code in query manager,
error is encountered.
What is the problem.
Regards,
Kit
Code:
declare @type int
declare @opening DateTime
declare @closing DateTime
declate @tmp DateTime
select @type = T0.ItmsGrpCod from [dbo].[oitb] T0 where T0.ItmsGrpNam = '[%0]'
select distinct @opening = T1.DocDate from [dbo].[oinm] T1 where T1.DocDate ='[%1]'
select distinct @closing = T2.DocDate from [dbo].[oinm] T2 where T2.DocDate = '[%2]'
/* swap date */
if @opening > @clsoing
begin
set @tmp = @opening
set @opeing = @closing
set @closing = @tmp
end
select ItemCode , BatchNum,
sum(Opening) as 'Opening',
sum(InQty) as 'InQty',
sum(OutQty) as 'OutQty',
sum(Closing) as 'Closing',
UnitCost ,
sum(TotalClosingStock) as 'TotalClosingStock',
sum(TotalOut) as 'TotalOut'
from (
select * from GetMovementReport(@type,@opening,@closing)
union
select * from GetSTMovementReport(@type,@opening,@closing)
) result
group by ItemCode , BatchNum, UnitCost
Hi Chun,
I can see couple of spelling errors:
1. declate @tmp DateTime must be: decla<b>r</b>e @tmp DateTime
2. if @opening > @clsoing should be if @opening > @cl<b>os</b>ing
3. set @opeing = @closing should be set @ope<b>n</b>ing = @closing
Hope it helps,
Adele
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.