Viewing 15 posts - 3,451 through 3,465 (of 3,957 total)
Lynn Pettis (6/7/2012)
UPDATE P SET
Stock = T.Stock
FROM
...
June 7, 2012 at 7:54 pm
As I have learned in my brief time posting to this forum, there's always a better way!
Not sure if this is but I'll take a shot.
CREATE TYPE MyTable AS TABLE
...
June 7, 2012 at 7:47 pm
Or, if I'm not mistaken, this should also work:
DECLARE @Date TABLE (Id int, start_time datetime, End_time datetime)--, time_diff
INSERT @Date
SELECT 16496, '2012-05-19 06:01:36.767', '2012-05-19 06:01:36.783' UNION ALL
SELECT 18496, '2012-05-19 06:01:36.767',...
June 7, 2012 at 7:24 pm
Perhaps a little more concisely:
DECLARE @qtr INT, @year VARCHAR(4)
SELECT @qtr=2, @year='2012'
;WITH Tally AS (SELECT TOP 366 n=ROW_NUMBER() OVER (ORDER BY (SELECT NULL))-1 FROM sys.columns)
SELECT Fridays=AllDays
FROM Tally
CROSS APPLY (SELECT DATEADD(day, n,...
June 7, 2012 at 7:02 pm
Jeff Moden (6/7/2012)
June 7, 2012 at 6:39 pm
saghbash (6/7/2012)
June 7, 2012 at 6:37 pm
Well, I can try. I saw this technique in the "Replace CASE expression and UNPIVOT operator" section of this article: http://beyondrelational.com/modules/2/blogs/70/posts/10905/interesting-enhancements-to-the-values-clause-in-sql-server-2008.aspx
The COUNT(Products) construct is counting non-null values across the...
June 7, 2012 at 6:31 pm
paul.knibbs (6/7/2012)
The following code generates a million rows of random integers (the SomeRandomInteger column) with possible values from 400 to...
June 7, 2012 at 3:57 am
Hey Jeff!
Using your test harness yesterday, I ran into some unexpected (for me) results. Let me explain:
--===== Declare some obviously named variables
DECLARE @NumberOfRows INT,
...
June 6, 2012 at 6:49 pm
David McKinney (6/6/2012)
dwain.c (6/5/2012)
SELECT Employee, NEW_LOB,...
June 6, 2012 at 2:16 am
I know that this is probably a little out of line of me, trying to bring the thread back on topic and all, but this problem was bugging me all...
June 6, 2012 at 12:30 am
Just to show that I'm keeping current on SQL 2008 stuff, and probably for no other reason, I thought I'd post a less verbose alternative.
SELECT Employee, NEW_LOB, NEW_DEPARTMENT, NEW_COST_CENTRE, NEW_MANAGER,...
June 5, 2012 at 7:42 pm
440692 I am just a number (6/5/2012)
I did notice that your example does not handle the range 1 - 100 that was required by the OP.
Ooops! You are correct....
June 5, 2012 at 3:05 am
Now here's an interesting result. I took a slightly refactored version of Vinu's EXCEPT query and compared across a large test harness to mine.
Create Table #Ex
(Column1 int, Column2...
June 5, 2012 at 12:37 am
I believe this will also do it for you, likely with only a single pass on the source table (other solutions probably do 2 passes):
Create Table #Ex
(Column1 int, Column2...
June 4, 2012 at 10:59 pm
Viewing 15 posts - 3,451 through 3,465 (of 3,957 total)