Viewing 15 posts - 1,096 through 1,110 (of 2,462 total)
Giorgio Vidali (12/17/2015)
-- Itzik Ben-Gan 2001
December 17, 2015 at 11:22 am

-- Itzik Ben-Gan 2001
December 17, 2015 at 8:25 am
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...
-- Itzik Ben-Gan 2001
December 16, 2015 at 8:35 pm
Eirikur Eiriksson (12/16/2015)
Alan.B (12/15/2015)
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>
...
-- Itzik Ben-Gan 2001
December 16, 2015 at 2:16 pm
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"...
-- Itzik Ben-Gan 2001
December 16, 2015 at 2:09 pm
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,...
-- Itzik Ben-Gan 2001
December 16, 2015 at 12:42 pm
Can you post some DDL and the execution plan?
-- Itzik Ben-Gan 2001
December 16, 2015 at 11:22 am
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...
-- Itzik Ben-Gan 2001
December 16, 2015 at 11:18 am
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...
-- Itzik Ben-Gan 2001
December 16, 2015 at 10:32 am
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
--...
-- Itzik Ben-Gan 2001
December 16, 2015 at 10:28 am
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...
-- Itzik Ben-Gan 2001
December 16, 2015 at 9:25 am
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...
-- Itzik Ben-Gan 2001
December 15, 2015 at 12:31 pm
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>
...
-- Itzik Ben-Gan 2001
December 15, 2015 at 11:59 am
Great article!
-- Itzik Ben-Gan 2001
December 15, 2015 at 8:35 am
paul.kemner (12/15/2015)
-- Itzik Ben-Gan 2001
December 15, 2015 at 8:25 am
Viewing 15 posts - 1,096 through 1,110 (of 2,462 total)