Forum Replies Created

Viewing 15 posts - 271 through 285 (of 2,462 total)

  • RE: Why does Microsoft recommend THROW over RAISERROR?

    A general observation is that the overal quality and consistency of Microsoft online documentation is declining. I digress.

    Raiserror has been on the chopping block for some time and...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Case Expresion Then Containing String of Text and attribute result?

    elzool - Thursday, May 4, 2017 4:33 PM

    I've a case expression that I'd like to look like this, but this isn't working.
    I'm...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Performance Tuning Using Extended Events: Part 3

    I love this series Brian, its very informative. Well done, 5 stars!

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Date Dimension Script

    Well done. It's always nice to see a RBAR-free, set-based approach to building tables like this. A few things I would change to improve performance:

    1. Make all the...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Is there a best way to combine data into a single output field

    Because the only text that you are dealing with is alphanumeric, you can change 
    FOR XML PATH(''), TYPE).value('.', 'varchar(max)'), 1, 1, '')
    to
    FOR XML PATH('')), 1, 1,...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Questions for me to ask during a job interview

    Regarding your first question about the DBA position.. I like try to feel them out to understand if I'm replacing someone or filling a new position and why. Often a...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Query Help - For Duplicates

    No problem!

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Query Help - For Duplicates

    inayatkhan - Thursday, April 27, 2017 8:07 AM

    Issue with this approach is I have big data set and some time I have...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Query Help - For Duplicates

    This can be improved but here's one way: 
    WITH piv AS
    (
    SELECT
     AID,
     name1 = MAX(CASE [name] WHEN 'LN' THEN [name] END),
     name2 =...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Reading from Extended events XML Column (event_data)

    Your double quotes don't look right they look like ASCII-148's whereas you want ASCII-34's. Try this:

    SELECT
    event_xml.value('(./@name)', 'varchar(1000)') as event_name,
    event_xml.value('(./data[@name="database_id"]/value)[1]', 'int')...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: XQuery error

    Mikael Eriksson SE - Monday, April 24, 2017 11:34 PM

    Using the parent axis when extracting values from XML is not good for...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: XQuery error

    Lisa Cherney - Monday, April 24, 2017 3:37 PM

    Alan.B - Monday, April 24, 2017 3:24 PM

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: XQuery error

    Your first Xpath Expression for Item/ItemNumber is wrong

    Instead of 
    N.value('(Item/ItemNumber[1])','int')
    You want 
    N.value('(Item/ItemNumber)[1]','int')


    declare @packXML XML = '<Pack>
    <PackID>1</PackID>
    ...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Need help on XML Query, Some tweaking help needed. - Report Sever related

    Building off Thom's solution, you could do something like this (note that I can't test this as I don't have an SSRS DB available)

    WITH getxml AS

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Property Text is not available for DefaultConstraint

    I'm not sure about this but, for a user to see object info they would need VIEW DEFINITION rights at the DB, Schema and Object level. Does this help? 

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 271 through 285 (of 2,462 total)