Forum Replies Created

Viewing 15 posts - 1,006 through 1,020 (of 10,144 total)

  • RE: Stored Procedure help

    ma701ss (1/3/2017)


    Forget returning the user id or data from any other columns, is it possible to amend the code to just return one value, i.e. either -2, -1 or 1?...

  • RE: Conditional Join

    thbaig (1/3/2017)


    No. It return all rows all time.

    I have updated description

    If you want results from either one table or the other, then use IF EXISTS()

  • RE: Conditional Join

    thbaig (1/3/2017)


    because if table2 has Reference_No, i want to display only these. Left join will display table1 data all the time

    Do you mean this?

    SELECT Reference_No

    FROM (

    SELECT Reference_No

    FROM dbo.tblOptionalRefNo

    UNION ALL

    SELECT...

  • RE: Conditional Join

    thbaig (1/3/2017)


    because if table2 has Reference_No, i want to display only these. Left join will display table1 data all the time

    Can you write a better description of what you are...

  • RE: Are the posted questions getting worse?

    Ed Wagner (1/3/2017)


    I hope everyone had a safe and happy New Year celebration. Welcome back to work.

    You too, Ed. Best wishes for 2017.

  • RE: Stored Procedure help

    ma701ss (1/1/2017)


    Hi, happy new year, been away and just coming back to this now.

    What I'm not understanding is why the return value is not either -1, -2 or 1. Why...

  • RE: Help Eliminating Duplicate Data

    Phil Parkin (12/28/2016)


    Note also that

    CASE WHEN height IS NULL THEN 0 ELSE 1 END

    may be shortened to

    IIF(Height IS NULL, 0, 1)

    It's shortened...but is it fastened too? :-))

  • RE: A New Vehicle

    "Twitter" wasn't one of the answers, so I used this clue instead.

  • RE: Help Eliminating Duplicate Data

    drew.allen (12/19/2016)


    Aggregate functions automatically exclude NULL values, so this can be simplified.

    SELECT *

    FROM (

    SELECT

    *,

    rn = ROW_NUMBER() OVER(PARTITION BY ProductId, ObjectId ORDER BY CheckNumber DESC)

    FROM EuroLuxProductBE.dbo.pdt_multidimensions m

    CROSS APPLY (

    SELECT...

  • RE: Help With Query !!!

    SELECT

    [Source],

    [Target],

    StartDate,

    EndDate = ISNULL(EndDate,LEAD(StartDate,1) OVER(PARTITION BY Source, Target ORDER BY StartDate,EndDate) - 1)

    FROM #TEMP

  • RE: SQL Help- Pivot/Case

    greeshatu (12/23/2016)


    @thom-2 a:Thank you for formatting my question .

    That is what I exactly want . Could pls help me out

    Actually My data will be huge So When I use the...

  • RE: Parsing paired relationships.

    The sample data set has a row where both columns have the same value which messes up rCTE's unless you remove it. Even then, some of the parent values have...

  • RE: Parsing paired relationships.

    Hi Richard, how many rows are you expecting back from this query?

  • RE: Help with delimited SQL

    nadersam (12/22/2016)


    Hi Guys,

    I am trying to execute an array of comma delimited SQLs in a stored procedure.

    I call it as below

    declare @Parameter as nvarchar(max)

    set @Parameter ='insert into Orderlog (trans_no)...

  • RE: Using Mod to Generate Work Shifts

    That's not bad, Joe - I think MOD is the way to go with this.

    The code can be trimmed down and tuned a little:

    SELECT ShiftLabel = CASE WHEN n...

Viewing 15 posts - 1,006 through 1,020 (of 10,144 total)