Viewing 15 posts - 3,556 through 3,570 (of 3,957 total)
SQL Kiwi (5/21/2012)
dwain.c (5/20/2012)
This has a comparable execution plan to Paul's submission (uses his setup data)Different semantics (see HowardW's two observations earlier).
Very cryptic, but I get your point that I...
May 21, 2012 at 12:21 am
This has a comparable execution plan to Paul's submission (uses his setup data):
UPDATE a
SET Age = (SELECT MAX(Age) FROM #TableB b WHERE b.UserID = a.UserID)
FROM #TableA a
May 20, 2012 at 10:36 pm
Here's yet another way:
DECLARE @t TABLE (status VARCHAR(30))
INSERT INTO @t
SELECT 'On Hold' UNION ALL SELECT 'On Hold' UNION ALL SELECT 'On Hold'
UNION ALL SELECT 'On Hold' UNION ALL SELECT...
May 20, 2012 at 10:01 pm
Perhaps like this?
DECLARE @t TABLE (col1 DECIMAL(9,0), col2 DECIMAL(9,0))
INSERT INTO @t
SELECT 143445634, 452674354
SELECT col1, col2, CAST(1.*col1/col2 AS DECIMAL(4,3))
FROM @t
May 20, 2012 at 9:47 pm
Maybe I'm oversimplifying this but here is one possible way:
DECLARE @Products TABLE
(
ProductID integer PRIMARY KEY CLUSTERED,
Quantity...
May 20, 2012 at 9:28 pm
Perhaps something like this?
DECLARE @primary TABLE (ID INT IDENTITY, Activity VARCHAR(30))
DECLARE @types TABLE (Activity VARCHAR(30), ActGroup VARCHAR(5))
INSERT INTO @primary (Activity)
SELECT 'Running' UNION ALL SELECT 'Jogging'
UNION ALL SELECT 'Walking' UNION...
May 20, 2012 at 9:16 pm
Jeff Moden (5/18/2012)
I didn't document a full spectrum test like Dwain did because I was actually hoping someone besides me would do...
May 18, 2012 at 10:32 pm
Jeff Moden (5/18/2012)
It's like what Dwaine C. did with the "n-tuple" problem... he came up with a way with an rCTE that I wouldn't have considered. I don't believe...
May 18, 2012 at 7:48 pm
I don't recall that being the error I was getting but since it is pretty explicitly saying that I was trying to be a naughty boy, I suppose I shall...
May 18, 2012 at 3:28 am
I must conclude that somehow I must have mucked it up then.
The only difference was that I wasn't doing an INSERT.
I'll have to give it another go sometime because it...
May 18, 2012 at 3:24 am
Jeff Moden (5/17/2012)
To return precisely what you asked for...
DECLARE @Year DATETIME;
SELECT @Year = '2011';
WITH
cteDate AS
(
SELECT EOM = DATEADD(mm,number,@Year)-1
FROM master.dbo.spt_values v
WHERE Type...
May 18, 2012 at 3:20 am
The above debate between Jeff and Paul is precisely the kind of discussion that I was hoping that my article would generate. I am particularly interested in seeing the...
May 17, 2012 at 11:51 pm
Jeff Moden (5/17/2012)
May 17, 2012 at 8:44 pm
DATE datatype contains no time component and is such better suited for storing things like DOB or a job start date (where time is not important).
May 17, 2012 at 7:53 pm
GSquared (5/17/2012)
May 17, 2012 at 7:05 pm
Viewing 15 posts - 3,556 through 3,570 (of 3,957 total)