Forum Replies Created

Viewing 15 posts - 436 through 450 (of 3,544 total)

  • RE: UNION to XML throws Msg 116, Level 16, State 1

    You need to wrap the subquery with another select and use FOR XML

    like this

    DECLARE @rssbody XML;

    SET @rssbody = (

    SELECT FLDB,PROC_SET_CODE,PROC_SET_NAME FROM (

    SELECT 'Fl01' as FLDB, PROC_SET_CODE, PROC_SET_NAME

    FROM [Fl01].[dbo].[PRSM]

    WHERE PROC_SET_CODE...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Today's Random Word!

    Luis Cazares (5/25/2016)


    ThomasRushton (5/25/2016)


    Ed Wagner (5/25/2016)


    Manic Star (5/25/2016)


    Hugo Kornelis (5/25/2016)


    Grumpy DBA (5/25/2016)


    ThomasRushton (5/25/2016)


    pain

    Joy and

    Heaven and

    Chocolate Sprinkles

    Ice Cream

    Cake!

    Birthday

    Antediluvian

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Pivoting with duplicate Values

    WITH a (PID,VisitType,Rn,RowNo)

    AS (

    SELECT PID,VisitType,Rn

    ,ROW_NUMBER() OVER (PARTITION BY PID,Rn ORDER BY VisitType ASC)

    FROM @PatDev

    ),

    b (PID,MaxRowNo)

    AS (

    SELECT PID,MAX(RowNo)

    FROM a

    GROUP BY PID

    )

    SELECT b.PID

    ,MAX(CASE WHEN c.C = 1 THEN ISNULL(a2.VisitType,a.VisitType) END) AS [Col1]

    ,MAX(CASE...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Dynamic Tablix

    Is there a specific reason why separate tables?

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Assigning max value + 1 to a column

    TheSQLGuru (5/20/2016)


    ....suffer from concurrency flaws....

    Nice catch Kevin 🙂

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Assigning max value + 1 to a column

    DECLARE @InvoiceNo int = ISNULL((SELECT MAX(o.InvoiceNo) FROM Orders o),0);

    WITH cte (ID,InvoiceNo)

    AS (

    SELECTo.ID,@InvoiceNo+ROW_NUMBER() OVER (ORDER BY o.ID ASC)

    FROMOrders o

    JOIN SetupAccountTypes a

    ON a.ID = o.AccountTypeID

    AND a.AccountType = 'COD'

    AND o.DeliveryDate >= '20160101'

    AND o.DeliveryDate...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Split Delimited String Across Fixed Number Of Columns

    First you need to allocate a unique number to each row

    Second use Jeff Moden's DelimitedSplit8K function (here) to split the data

    Third use PIVOT or CASE statements to pivot...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    Lowell (5/16/2016)


    Complete non-sequitur here guys, but I'm rather pleased with myself.

    I just got my MCSA after taking 70-463 Implementing a Data Warehouse in SQL Server 2012/2014.

    I had set a mental...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SSRS Average on two columns

    Create a new report, add data source and dataset

    Drag all four columns (ID Seller Hyderabad Bangalore) to detail box

    continue on to finish report

    Double click on Details_Group under Row Groups

    Click Add...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Urgent! - How to extract number from a string

    KMM-489657 (11/15/2007)


    I was just reading thru this thread and I have a similar issue. I'm trying to extract the number string from a StarRating of Hotels column. For example the...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    WayneS (5/6/2016)


    33 years... wow. I sure hope that you have been quite happy with them.

    Well there have been ups and downs but I weathered the storms and even survived some...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    Grumpy DBA (5/4/2016)


    ^ I agree with Brandie. Matter of fact that's how I came to my current employer, a former colleague has been here for 8 years and enjoys...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Talking baseball

    Glad I got a channel now to watch it, missed it for ages.

    Watched a replay of the 5 hour marathon of the Red Sox / Astros game.

    Thrilling game could not...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    Ed Wagner (4/25/2016)


    Another good one is to say that someone's "out to lunch". Well, I've taken that a step further and say that someone's "so out to lunch -...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    Jeff Moden (4/24/2016)


    My favorite of all time, though, is "If he had 2 brains, he'd be twice as stupid". 😀

    Hey, I resemble that remark :crazy:

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 436 through 450 (of 3,544 total)