Forum Replies Created

Viewing 15 posts - 3,781 through 3,795 (of 10,144 total)

  • RE: SubProcedure (Subroutines) within Stored Procedure

    skb 44459 (1/7/2014)


    Do you have an example ? I don't necessarily want different Stored Procedures.

    I need multiple SubRoutines within One Stored Procedure, so that they can share the Variables and...

  • RE: Stored Procedure to remove all records that don't have max FileID

    Truncating the table before loading new data would be more efficient - is there some reason why you chose the CTE instead?

  • RE: Stored Procedure to remove all records that don't have max FileID

    petr.caslavka (1/7/2014)


    This will work great. thank you very much for your help,

    Petr

    Which option?

  • RE: SubProcedure (Subroutines) within Stored Procedure

    Yes you can - stored procedures with input and output parameters can be nested within a calling stored procedure. Do you really need the code blocks configured as "subroutines"?

  • RE: Get Next Id with a MERGE

    Something like this:

    DECLARE @NextSeqId INT

    SET @NextSeqId = dbo.FN_GetNextSeqId4CRM_MNP_ORIGINAL_NRN()

    ;WITH CTEseriesnacionales AS (

    SELECT NextSeqId = @NextSeqId + (ROW_NUMBER() OVER(ORDER BY RangoIni)-1),

    *

    FROM dbo.seriesnacionales

    )

    MERGE dbo.CRM_MNP_ORIGINAL_NRN AS T

    USING CTEseriesnacionales AS S

    ON (T.RANGE1 = S.RANGOINI )

    ...

  • RE: Complex Query. Please help

    Working on a completely different principle, this will perform differently to Luiz' fine solution. Test them and assuming they return correct values, choose the fastest - on the assumption that...

  • RE: Begginer in SQL Procedures

    A slightly different approach from the previous two, triggered by a gruelling telephone survey I was foolish enough to agree to participate in just a couple of weeks ago. There...

  • RE: DATEDIFF Statement help!

    joey6401c (1/6/2014)


    Thanks for the reply

    I modified my query but it returns an error

    Delcare @dt date

    Set @dt = GETDATE()

    select distinct v1.name 'Machine Name', v1. 'Username', t1.displayname 'Unlicensed Application', t1.installdate 'Install Date'...

  • RE: Max Function Output Mapping to get Description

    waheed71 (1/6/2014)


    ...Let me explore this in more details...

    That's the ticket!

    Thanks for the feedback.

  • RE: Max Function Output Mapping to get Description

    waheed71 (1/6/2014)


    Dear Chris,

    Thank you. Can you please give me example of below text.

    Change the join column on my query to whichever MAX column fits your requirement.

    Sure.

    Change this:

    INNER JOIN ST_SUPPLIER su...

  • RE: Max Function Output Mapping to get Description

    waheed71 (1/6/2014)


    Dear ChrisM / Dear Lowell,

    Thanks for the prompt reply. I am really sorry about not able to communicate properly. So far I am unable to get required result.

    I just...

  • RE: DATEDIFF Statement help!

    If you haven't got a timestamp date/time column in your table, how can you tell if something is more than 7 days old?

    Does your table have an assocoation with any...

  • RE: Max Function Output Mapping to get Description

    Slightly different to Lowell's code and I'm not sure which is correct:

    SELECT

    d.TR_STOCKNO,

    d.CT_STOCKSUMMARY,

    d.PH_SUPPLIERCODE,

    su.SU_SUPPLIERNAME,

    d.PH_RAISEDDATE,

    d.TR_DATE,

    d.LASTPO,

    d.LASTVENDOR,

    d.LASTGRN,

    d.Age

    FROM (

    SELECT

    tr.TR_STOCKNO,

    ct.CT_STOCKSUMMARY,

    ph.PH_SUPPLIERCODE,

    --SU_SUPPLIERNAME,

    ph.PH_RAISEDDATE,

    tr.TR_DATE,

    MAX(ph.PH_RAISEDDATE) OVER (PARTITION BY tr.TR_STOCKNO) AS LASTPO,

    MAX(ph.PH_SUPPLIERCODE) OVER (PARTITION BY tr.TR_STOCKNO) AS LASTVENDOR,

    MAX(TR_DATE) OVER (PARTITION...

  • RE: please help me

    ROW_NUMBER() on an outer SELECT will often return the results in the ROW_NUMBER() order, which could make your query equivalent to this:

    SELECT rownumber, linknumber, savabegh

    FROM (

    SELECT

    rownumber = ROW_NUMBER()...

  • RE: please help me

    The splitter discussed here [/url]is shown to be far superior in performance terms to either of the two already listed oon this thread. Here's how you would use it to...

Viewing 15 posts - 3,781 through 3,795 (of 10,144 total)