Viewing 15 posts - 2,071 through 2,085 (of 4,087 total)
This approach will work, but it may not be the most efficient. It uses XML concatenation to create a comma-separated list of the ingredients and then checks for two...
December 22, 2016 at 11:32 am
Phil Parkin (12/22/2016)
IF OBJECT_ID('tempdb..#tmp', 'U') IS NOT NULLDROP TABLE #tmp;
CREATE TABLE #tmp
(
FormulaId CHAR(2)
, IngredientId CHAR(2)
);
INSERT #tmp
...
December 22, 2016 at 11:20 am
Not necessarily. The problem is when a field from an outer table is used in a JOIN condition (or WHERE clause) without taking into account that it might be...
December 22, 2016 at 10:12 am
Thom A (12/22/2016)
WITH CTE (EVENT_ID, EVENT_RANK, MIN_AGE, MAX_AGE, C_MIN, C_MAX) AS
(
SELECT A.EVENT_ID,
A.EVENT_RANK,
A.MIN_AGE,
...
December 22, 2016 at 9:37 am
Manic Star (12/21/2016)
jasona.work (12/21/2016)
Ed Wagner (12/21/2016)
jasona.work (12/21/2016)
Ed Wagner (12/21/2016)
Revenant (12/21/2016)
GulfFishing
Ice
Lake
Huron
Bird
Archeopteryx
December 21, 2016 at 1:56 pm
Something along the lines of the following.
SELECT c.value('@name', 'VARCHAR(50)')
FROM @doc.nodes('/xs:schema/xs:element/xs:complexType/xs:sequence/xs:element[2]/xs:complexType/xs:sequence/xs:element[1]/xs:complexType/xs:sequence/xs:element') T(c)
You may need to use a CROSS APPLY if the XML is stored in a column instead of a variable....
December 21, 2016 at 1:37 pm
whenriksen (12/21/2016)
DK13 (12/20/2016)
NULL is a valid action type.
I'll save Celko the effort here. NULL is not a valid action type. It is messing up your results because you...
December 21, 2016 at 10:39 am
You're using a subquery to get the rank when you should be using ROW_NUMBER().
/*ranking*/
SELECT compmcd.hedismeasure,
compmcd.measureid,
compmcd.competitor,
compmcd.market,
compmcd.prodabbrev,
compmcd.hedisrate,
ROW_NUMBER() OVER(PARTITION BY measureid, market, prodabbrev ORDER BY hedisrate DESC, measureid DESC ) AS rn
FROM...
December 20, 2016 at 4:22 pm
matthew.livingston (12/20/2016)
Not sure if it is okay to post this here, but if this is correct, it will help everyone understand better. OP could help verify.pages 365-367
Yes, it looks like...
December 20, 2016 at 4:13 pm
sgmunson (12/20/2016)
-- code snipped to pinpoint this section
SELECT D.*,
CAST(D.[Date] AS date) AS DATE_ONLY,
CASE
WHEN CAST(LEAD(D.[Date], 1, '9999-12-31') OVER(ORDER BY D.[Date]) AS date) =...
December 20, 2016 at 3:53 pm
Jason A. Long (12/20/2016)
IF OBJECT_ID('tempdb..#Data', 'U') IS NOT NULL
DROP TABLE #Data;
CREATE TABLE #Data (
ID VARCHAR(20),
SEQ INT,
Date...
December 20, 2016 at 3:32 pm
Most approaches that I've seen collapse the ranges. That is, they don't retain a record with a zero length. Is there a particular reason that you need to...
December 20, 2016 at 2:14 pm
Your DateKey is defined as INT. Don't provide your sample data as CHAR, because it forces an implicit conversion.
You say that your data contains NULLs which are causing you...
December 20, 2016 at 2:03 pm
Brad Feaker-195979 (12/20/2016)
Got the same results - but thanks...
The query I gave you will produce a row with NULL values for the grouped fields. Since your results DO NOT...
December 20, 2016 at 10:49 am
I suspect what you want is
GROUP BY GROUPING SETS((EDI_Batch_Number, Reference_2),())
which will give you groups by EDI_Batch_Number/Reference and then a grand total.
What you currently have gives your one group on...
December 20, 2016 at 8:50 am
Viewing 15 posts - 2,071 through 2,085 (of 4,087 total)