Viewing 15 posts - 2,491 through 2,505 (of 4,087 total)
Please provide sample data and expected results as listed in the first link in my signature.
Drew
August 4, 2016 at 12:57 pm
Your rCTE should start with the original stakeholders, instead of starting with the stakeholder that you are interested in, because you only need to traverse the tree in one direction...
August 4, 2016 at 12:05 pm
Look up ROW_NUMBER, specifically Example B: Returning a subset of rows. You want to return the subset where the ROW_NUMBER equals 1. You just have to define the...
August 4, 2016 at 9:08 am
Boris Pazin (8/4/2016)
drew.allen (8/4/2016)
August 4, 2016 at 8:58 am
Have you considered using SEQUENCE instead of an IDENTITY? Sequences are similar to identities, but they're not tied to a specific table.
There is another approach, but it's a lot...
August 4, 2016 at 8:44 am
Luis Cazares (8/3/2016)
drew.allen (8/3/2016)
Luis Cazares (8/3/2016)
pnr8uk (8/3/2016)
...
August 3, 2016 at 3:35 pm
Luis Cazares (8/3/2016)
pnr8uk (8/3/2016)
(...
August 3, 2016 at 1:55 pm
You have a main query and three subqueries. The subqueries can only access fields within their scope and the parent's scope. They cannot access fields/tables from the other...
August 3, 2016 at 12:02 pm
And here is an option changing the last part to a NOT EXISTS. This also assumes that PolicyInsuredLocGK cannot be NULL.
AND NOT EXISTS (
SELECT 1
FROM AIRGBS.vLCExtract AS lc2
WHERE lc.AccountNum...
August 3, 2016 at 8:52 am
scottcabral (8/3/2016)
i get this:Use of DISTINCT is not allowed with the OVER clause
You can still use windowed functions, but it's a bit more complicated. I would start with something...
August 3, 2016 at 8:47 am
You haven't supplied the expected output, but I suspect you are trying to transpose the data rather than pivot the data. You would need to unpivot followed by a...
August 3, 2016 at 8:36 am
regan.wick (8/2/2016)
I read the post you cited. This is the key line from it.
"3.Use inline TVF when possible: In the demo, it’s unnecessary to use a multi-statement TVF....
August 2, 2016 at 4:05 pm
Part of the problem that you are having is that the IN clause of a PIVOT requires a set of quoted identifiers, but you are supplying expressions. When determining...
August 2, 2016 at 1:36 pm
Jampandu (8/2/2016)
/*
-- Expected output
<?xml version=”1” encoding=”utf-8”?>
<Batch>
BatchID=”1” Count=”999” Status=”Errors”
<Doc>
Type=”XXX” Code = “XXXX” Number=”xx111” Id=”9999”
<Error>888</Error>
<Address>Address1</Address>
</Doc>
</Batch>
*/
Are you sure you don't want your output to look more like this (that is...
August 2, 2016 at 12:35 pm
Since you are on SQL 2012, have you considered using LEAD/LAG instead of doing a self-join?
Drew
August 1, 2016 at 1:53 pm
Viewing 15 posts - 2,491 through 2,505 (of 4,087 total)