Viewing 15 posts - 2,521 through 2,535 (of 4,087 total)
That's because LAG is for a relative position. FIRST_VALUE and LAST_VALUE are for absolute positions. You do have to get a little tricky, because you need to ensure...
July 21, 2016 at 3:05 pm
CELKO (7/21/2016)
The bit and varying bit datatypes were deprecated in SQL: 2003 for good reasons. You can read some of this: https://www.simple-talk.com/sql/t-sql-programming/bit-of-a-problem/.
Yes, but the SQL standards also have a BOOLEAN...
July 21, 2016 at 1:02 pm
Sean Lange (7/21/2016)
drew.allen (7/21/2016)
SELECT DISTINCT STUFF(
(SELECT ', ' + t2.Name
FROM #Temp t2
where...
July 21, 2016 at 11:33 am
Get rid of the ISNULL altogether. FOR XML automatically discards null expressions unless the XSINIL directive is specified.
SELECT DISTINCT STUFF(
(SELECT ', ' + t2.Name
FROM #Temp t2
where t1.ID = t2.ID...
July 21, 2016 at 9:41 am
It's not clear how these results derive from your sample data: specifically, it's not clear why there are two rows for ER instead of 1, and it's not clear where...
July 15, 2016 at 12:28 pm
kewlguy13 (7/15/2016)
If I had to design the Junk dimension with these values, what do you suggest.
What would be Junk Dimension structure?
Logic: I was thinking about CROSS...
July 15, 2016 at 12:21 pm
kewlguy13 (7/15/2016)
Looking at the target table structure, I could see that Cross Join doesn't fit. That's where I was confused.
I will try with the EAV...
July 15, 2016 at 8:50 am
Jabba1963 (7/15/2016)
July 15, 2016 at 8:25 am
Your design is for an EAV table, not a junk dimension. A junk dimension is derived from the Cartesian product of your attributes so it would look more like
JunkID
SubscriptionStatus
CustomerStatus
PaymentDesc
Document
CaseType
TransportedTo
Obviously,...
July 15, 2016 at 7:59 am
I found a solution that seems to perform very well given certain pre-conditions.
There must be fewer than 31 (or...
July 14, 2016 at 3:38 pm
You can place your CASE expression in a CTE, derived table, or CROSS/OUTER APPLY and then do the SUM in the main query.
Drew
July 13, 2016 at 8:16 am
Because you haven't specified a data type for the value NULL, and it can't figure it out from the value itself, so it assigns a NULL data type. It's...
July 12, 2016 at 1:22 pm
This is a presentation issue and should be left to the presentation layer.
I am not seeing any strange characters when I run it. XML will entitize CHAR(13) (
), so...
July 12, 2016 at 11:45 am
cad.delworth (7/12/2016)
drew.allen (7/11/2016)
The reason that you were getting bad results is that your "dates" aren't really dates. They're strings, so they sort alphabetically.
The OP didn't specify the data type...
July 12, 2016 at 10:31 am
kobi.burkis (7/12/2016)
HiThank you drew.allen for a quick response.
I don't have an aggregate function to apply on the table for pivoting.
You actually do. If you can guarantee a...
July 12, 2016 at 7:56 am
Viewing 15 posts - 2,521 through 2,535 (of 4,087 total)