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 a comment
10|10000 characters needed characters exceeded

Related questions

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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.