Skip to Content
author's profile photo Former Member
Former Member

Query Manager Input Date Problem

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

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2006 at 08:20 AM

    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

    Add comment
    10|10000 characters needed characters exceeded