Viewing 15 posts - 376 through 390 (of 444 total)
Look at PIVOT operator http://technet.microsoft.com/en-us/library/ms177410(v=SQL.105).aspx
October 16, 2014 at 3:58 am
SELECT [row group level 2003 April] = [2003].April -[2002].April
FROM [Matrix Report] AS [2003]
JOIN [Matrix Report] AS [2002] ON [2003].[Unnamedcol] = 2003 AND [2002].[Unnamedcol] = [2003].[Unnamedcol] -1
If...
October 16, 2014 at 2:09 am
Hope he will not run delete statements without a where clause some day.
I see it's rather department administrator's problem rather then DB admin's problem.
October 16, 2014 at 1:56 am
"Besides, null values in the input of UNPIVOT disappear in the output."
Exactly. But it means 2 rows. 😉
October 16, 2014 at 1:35 am
Look at inline TVF http://technet.microsoft.com/en-us/library/ms189294(v=sql.105).aspx
October 15, 2014 at 4:10 am
Use dates functions, dateadd() namely.
declare @Month varchar = '01'
declare @Year varchar = '2014'
select starDt = CAST(@Year + @Month +'01' as Date), endDt = dateadd(dd,-1,dateadd(mm,1, CAST(@Year + @Month +'01' as...
October 15, 2014 at 3:59 am
SELECT Incident, cnt = COUNT(distinct ID)
FROM Sampledata
GROUP BY Incident
HAVING COUNT(distinct ID) > 1
October 15, 2014 at 2:28 am
inevercheckthis2002 (10/14/2014)
The latest time for an event in the source table. Basically, I would like to record all of the changes to the source table by creating another...
October 15, 2014 at 1:24 am
Don't you need group by / partition by V1 ?
October 15, 2014 at 12:07 am
ot 60857, for
INSERT INTO @PersonTime
SELECT 1, 1001, 23, '10/13/2014 8:00:00', '10/13/2014 8:30:00' UNION ALL
SELECT 11, 1011, 23, '10/13/2014 8:30:00', '10/13/2014 9:00:00'
your solution gives
232014-10-13 08:00:00.0002014-10-13...
October 14, 2014 at 4:30 am
Provided 15 min is a fixed step
create table #tbl ( V1 int, V2 datetime, V3 float);
insert into #tbl values (1,'2012-12-12 10:15', 12.5);
insert into #tbl values (1,'2012-12-12 10:30', 2.5);
insert into...
October 14, 2014 at 12:47 am
insert into #tbl values (1,'2012-12-12 10:35', 2.5)
So timestamp is allowed to be not 15 minutes aligned? Or is it a misprint?
October 13, 2014 at 6:43 am
Try
SET DATEFORMAT mdy;
DECLARE @PersonTime TABLE
(
ID INT,
Person INT,
Room INT,
Coming DATETIME,
Going DATETIME
);
INSERT INTO @PersonTime
SELECT 1, 1001, 23, '10/13/2014 8:00:00', '10/13/2014 9:00:00' UNION ALL
SELECT 2, 1002, 23, '10/13/2014 8:05:00', '10/13/2014...
October 13, 2014 at 6:02 am
October 7, 2014 at 5:54 am
To identify circles
DECLARE @Tmp TABLE (CustomerID INT, CustomerLink INT, PRIMARY KEY(CustomerID))
INSERT @Tmp
VALUES(100001,0)
,(100002,100001)
...
October 7, 2014 at 5:42 am
Viewing 15 posts - 376 through 390 (of 444 total)