Skip to Content

replacing SQL parameters by [%] in sbo

I have the following simple sql query which is part of longer SQL query .

I want to run the entire query in SBO .

question : How to replace SQL parameters in the query by SBO Parameters ( [%0] )

declare @start date = convert (date,'01/01/2017',103),

@end date = convert (date,'01/12/2017',103) ;

select convert (date,t0.DocDate,103) AS DocDate ,

'curentPeriod ' as curentPeriod, t0.DocTotal as DocTotal , t0.CardCode as cardCode, T0.SlpCode as Splcode

from OINV t0

where T0.DocDate between @start and @end

and t0.CardCode <>3000001

union all

select convert (date,t0.DocDate,103) AS DocDate ,

'curentPeriod ' as curentPeriod,

t0.DocTotal as DocTotal ,

t0.CardCode as cardCode,

T0.SlpCode as Spl from ORIN t0

where T0.DocDate between @start and @end

and t0.CardCode <>3000001 ;

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Nov 24, 2017 at 11:01 AM

    Hi,

    Here is an example syntax:

    /* select  * from OJDT t1   */
    DECLARE @EndDate DATETIME
    SET @EndDate = /* t1.RefDate */  '[%0]'
    SELECT @EndDate

    Regards,

    Johan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 24, 2017 at 12:29 PM

    Hi

    Thanks for both answers.

    CTE works , haven't tried yet TVF.

    dov

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 11, 2017 at 08:06 AM

    Hi John

    I guess it was my mistake, sorry.

    i am quite Newbie to SBO . can i ask you more questions concerning building complicated queries in query generator ?

    Best regards,

    Dov

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Dov,

      Don't worry about it, I don't think it was your mistake. This SCN platform is only a year old and there is still a lot wrong with it.

      Of course you can ask as many questions as you like. However, please post a new question for each issue. That way more people will try to help you.

      Regards,

      Johan

      P.S. when you clicked 'Accept' the first time, did you double-click, or did you have to click a second time because the page did not show you right away that the answer was accepted?

  • Posted on Dec 11, 2017 at 11:07 AM

    Hi;

    I really dont remember;

    I

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 11, 2017 at 06:38 PM

    Hi;

    Screen shoot 1 capture-1.png

    Screen shoot 2 after accepting capture-2.png

    I am using Google Chrome on Dell XPS laptop OS is Window 10 pro


    capture-1.png (73.1 kB)
    capture-2.png (68.8 kB)
    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.