Forum Replies Created

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

  • 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

  • RE: Powershell script to find the text between two strings

    If you have some basic SQL and XML knowledge you can use SQLXML to query the packages for the ConnectionManager. ConnectionManger Info lives in DTS:ConnectionManger. 
    For example, if your...
    "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 puzzle

    Yes, loops bad. Set-based good. 

    First for some sample data:
    IF OBJECT_ID('tempdb..#stu') IS NOT NULL DROP TABLE #stu;
    CREATE TABLE #stu(nid int NULL, student_name varchar(100) NOT NULL);

    "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: Selecting all text between a distinct path

    I'm a little late here but I have a function that is designed for exactly this type of thing. If you grab a copy on NGrams8k you could create...

    "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: The "Numbers" or "Tally" Table: What it is and how it replaces a loop.

    AnthonyR - Tuesday, April 11, 2017 11:44 PM

    Jeff Moden - Tuesday, April 11, 2017 8:42 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

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