Forum Replies Created

Viewing 15 posts - 1,096 through 1,110 (of 2,462 total)

  • RE: Get pick list from XML data file

    Giorgio Vidali (12/17/2015)


    One final thing I'd like to ask is.... considering that I will have to get more and more familiar with XML data... what is the best resource to...

    "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: Are the posted questions getting worse?

    "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: Hierarchies on Steroids #1: Convert an Adjacency List to Nested Sets

    I'm doing my first adjacency list to nested sets conversion and building out a rather complex hierarchy table for a new project (something I've been anxious to do since I...

    "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: Get pick list from XML data file

    Eirikur Eiriksson (12/16/2015)


    Alan.B (12/15/2015)


    another way...

    DECLARE @x XML = '<?xml version="1.0" encoding="UTF-8"?>

    <StaffingOrder>

    <OrderId validFrom="12/31/2015" validTo="12/31/2015">

    <IdValue>JNJNJP00040440</IdValue>

    <Status>Submitted</Status>

    </OrderId>

    <StaffingPosition>

    ...

    "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: Get pick list from XML data file

    Using your attached example you would modify the XPath Expression like so

    *:StaffingOrder/*:StaffingPosition/*:CustomFields/*:CustomField[@name="Reason for Request"]/*:pickList/*:item'

    Here's the full solution:

    DECLARE @x XML =

    '<?xml version="1.0" encoding="UTF-8"?>

    <StaffingOrder xmlns="jobPosting" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="jobPosting https://xuat.fgvms.com/schema/InSiteJobPostingV2.xsd">

    <OrderId validFrom="12/31/2015"...

    "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: Trying to CROSS JOIN a table and a function without success

    IF you want to pass columns to a table valued function like that you need to use APPLY. I suspect that this will work for you:

    SELECT RigsVolTable

    , Try_convert(float,...

    "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: Rewrite query for better performance

    Can you post some DDL and the execution plan?

    "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: sp_MSforeachdb error

    tt-615680 (12/16/2015)


    SET NOCOUNT ON;

    Exec sp_MSforeachdb 'USE ?

    DECLARE @objectid int;

    DECLARE @indexid int;

    DECLARE @partitioncount bigint;

    DECLARE @schemaname nvarchar(130);

    DECLARE @objectname nvarchar(130);

    DECLARE @indexname nvarchar(130);

    DECLARE @partitionnum bigint;

    DECLARE @partitions bigint;

    DECLARE @frag float;

    DECLARE @command nvarchar(4000);

    DECLARE @dbid smallint;

    SET @dbid...

    "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: Using Multi-result subquery in expression

    stevennjuki (12/16/2015)


    Thanks, but the solution provided by Drew is scalable, which is what I wanted. Thanks any way

    Cool. On a side note for future reference about UNION... UNION ALL pretty...

    "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: Using Multi-result subquery in expression

    John more-or-less beat me to it and drews solution is probably better but here's what I came up with. Using an inline table valued function you could do this:

    USE tempdb

    GO

    --...

    "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: Maxdop query

    MAXDOP restricts the number of CPUs that can be used in a parallel query plan. MAXDOP 0 let's SQL Server use as many as SQL Server wants (up to 64...

    "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: Get pick list from XML data file

    Phil Parkin (12/15/2015)


    Nice one, Alan. Much tidier.

    Thanks Phil...

    And since I had a few minutes to kill during lunch, a set-based solution that uses no XML...

    -- declaring as varchar 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: Get pick list from XML data file

    another way...

    DECLARE @x XML = '<?xml version="1.0" encoding="UTF-8"?>

    <StaffingOrder>

    <OrderId validFrom="12/31/2015" validTo="12/31/2015">

    <IdValue>JNJNJP00040440</IdValue>

    <Status>Submitted</Status>

    </OrderId>

    <StaffingPosition>

    <CustomFields>

    ...

    "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: Analysing Sales Patterns: R + SQL Server

    Great article!

    "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 Years of Experience

    paul.kemner (12/15/2015)


    The flip side is that a lot of consulting companies will grossly oversell your skillset to get a paying contract. They'll sell you as an expert in xyz language,...

    "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 - 1,096 through 1,110 (of 2,462 total)