Viewing 15 posts - 1,096 through 1,110 (of 1,246 total)
Based on the stated requirements... I think this is what you're looking for...
IF OBJECT_ID('tempdb..#temp') IS NOT NULL
DROP TABLE #temp;
CREATE TABLE #temp([term] int,
...
July 29, 2015 at 11:29 am
Steve - Very nice solution! 🙂
sgmunson (7/29/2015)
July 29, 2015 at 7:59 am
I tried loading up your new test data... It's throwing errors. Please check your insert statements.
Also, as a matter of convenience and readability... Please post code inside a sql code...
July 29, 2015 at 6:38 am
The computer is off for the night. I'll retest tomorrow with your updated test data.
July 28, 2015 at 10:24 pm
petervdkerk (7/28/2015)
July 28, 2015 at 9:37 pm
Here is another option that uses "Nested Sets". The stored proc (dbo.CreateNestedSets) is based off of the code provided by Jeff Moden (Hierarchies on Steroids #1: Convert an Adjacency List...
July 28, 2015 at 9:11 pm
petervdkerk (7/28/2015)
July 28, 2015 at 8:52 pm
petervdkerk (7/28/2015)
I now see that this groups all article groups, independent of the productid...how would I alter this query to return only the concatenated...
July 28, 2015 at 8:20 pm
The actual text of stored proc can be found in sys.sql_modules.
July 28, 2015 at 7:46 am
When doing a concatenation... NULL + anything = NULL.
Wrapping NULL values in a COALESCE or ISNULL function can convert null values into empty strings (blanks)
COALESCE(t.ColumnName, '') or ISNULL(t.ColumnName, '')
July 28, 2015 at 7:38 am
Sean Lange (7/27/2015)
Jason A. Long (7/27/2015)
SELECT ID, [Date],0 AS T1, I1 FROM K1
UNION ALL
SELECT ID, [Date], T1, 0 AS I1...
July 27, 2015 at 4:41 pm
This should give you what you're looking for...
SELECT ID, [Date],0 AS T1, I1 FROM K1
UNION ALL
SELECT ID, [Date], T1, 0 AS I1 FROM K2
ORDER BY ID, [Date]
July 27, 2015 at 1:47 pm
Based on what you have and the output that you have shown, the following should give you what you're looking for...
SELECT
m1.ParentID AS Account_ID,
STUFF((
SELECT ', ' + CAST(m2.ChildID AS VARCHAR(8))
FROM...
July 24, 2015 at 11:32 am
There's also no need to write this as a CROSS JOIN... It's actually what Jeff would refer to as a "triangular join".
SELECT
CityName
INTO #City
FROM (VALUES ('Jax'),('Orlando'),('Miami'),('Tally'),('Appalach'),('Lake City'),('Panama City')) City (CityName)
SELECT
c1.CityName...
July 24, 2015 at 8:09 am
Here's yet another version...
IF OBJECT_ID('tempdb..#temp') IS NOT NULL
DROP TABLE #temp;
SELECT 'S3925' AS partnum, 'MDSHT 3000 x 1500 x 6mm (7.5mmO/A HEIGHT) MS' AS partdescription INTO #temp;
SELECT
t.partnum,
MAX(CASE WHEN sc.ItemNumber...
July 23, 2015 at 1:42 pm
Viewing 15 posts - 1,096 through 1,110 (of 1,246 total)