Viewing 15 posts - 3,151 through 3,165 (of 3,957 total)
While BrainDonor's (love that name) suggestion will work, I find the UNPIVOT syntax so unwieldy (especially on double and triple UNPIVOTs) that I like to steer people towards the CROSS...
July 24, 2012 at 7:22 pm
First off, you should probably be using MERGE for this.
Second, in a high transaction database, using IF EXISTS followed by UPDATE/INSERT as you are doing is quite dangerous because some...
July 24, 2012 at 7:12 pm
Using only the stone knives and bear skins available in SS2K, I think this will run without error on that ancient platform, and may produce something somewhat close to what...
July 24, 2012 at 7:05 pm
Let me apologize for my original bone-headed post. Not only did I screw up the syntax (I blame my current cognitive overload), I failed to notice that you're using...
July 24, 2012 at 6:43 pm
Evil Kraig F (7/24/2012)
July 24, 2012 at 6:27 pm
OK I see the DDL now, sorry I missed it earlier.
Sample data can be done with an INSERT like as follows:
INSERT INTO dbo.Table
SELECT 1,2,3,4 -- As many...
July 23, 2012 at 11:47 pm
Jeff Moden (7/23/2012)
I've not found rCTE's to be very fast at very much.
I know you're a busy guy Jeff, so you must've missed my rCTE solution to the Sweden redistricting...
July 23, 2012 at 10:26 pm
gert.lindholm (7/23/2012)
When i was yunger i also loathe my name.
But older i get i get used to it.
My middle name is Erik.
And i´m named by an old...
July 23, 2012 at 9:52 pm
xmozart.ryan (7/23/2012)
dwain.c (7/23/2012)
;WITH Tally (n) AS (
ROW_NUMBER() OVER (ORDER...
July 23, 2012 at 9:49 pm
XMLSQLNinja (7/23/2012)
I must be missing something but I don't see how that recursive CTE (as much as I...
July 23, 2012 at 5:21 pm
GSquared (7/23/2012)
dwain.c (7/23/2012)
GSquared (7/19/2012)
Jeff Moden (7/17/2012)
GSquared (7/17/2012)
He was talking about the last solution I posted. That's a while-loop version.
First, apologies for not responding sooner. I've actually be working...
July 23, 2012 at 7:34 am
Gert - You're most welcome.
I have a brother named Gert, although he is loathe to use that name. He uses his middle name instead.
July 23, 2012 at 6:25 am
We seem to be overlooking the cardinality rule of comments:
"Comments in code are always out of date and hence inaccurate."
Could be this used to apply but does no more.
I like...
July 23, 2012 at 3:04 am
Assuming you want one result set returned to your client, you should consider doing it something like this:
;WITH Tally (n) AS (
ROW_NUMBER() OVER (ORDER BY (SELECT...
July 23, 2012 at 3:00 am
GSquared (7/19/2012)
Jeff Moden (7/17/2012)
GSquared (7/17/2012)
He was talking about the last solution I posted. That's a while-loop version.
First, apologies for not responding sooner. I've actually be working on a...
July 23, 2012 at 2:43 am
Viewing 15 posts - 3,151 through 3,165 (of 3,957 total)