Viewing 15 posts - 901 through 915 (of 1,439 total)
Try this
WITH CTE AS (
SELECT
ID, CaseNumber1, DateFiled, OpenActionCode, JudgeNumber, TermDate, TermActionCodeID, ReOpenedCase, VisitJudge, CaseTypeNumber, SubmittedDate, RulingDate,
PreviousFileDate, Note, CDatefiled, CTermdate, CSubmittedDate, CRulingDate,
ROW_NUMBER() OVER(PARTITION BY CaseNumber1 ORDER BY TermDate DESC) AS rn
FROM
tblSupremeCourt
WHERE
TermDate...
September 17, 2010 at 7:25 am
SELECT r.value('@EMAIL','VARCHAR(30)') AS EMAIL,
r.value('@PHONE','VARCHAR(30)') AS PHONE
FROM @xml.nodes('/P/REC_LIST/REC') AS x(r)
September 16, 2010 at 7:03 am
WITH Summary AS (
SELECT ID,
SUM(CASE WHEN status=5 THEN 1 ELSE 0 END) AS Fives,
SUM(CASE WHEN status=6...
September 15, 2010 at 3:34 am
WITH CTE AS (
SELECT UserID, TaskID,
COUNT(*) OVER(PARTITION BY UserID,TaskID) AS cn,
ROW_NUMBER() OVER(PARTITION BY...
September 8, 2010 at 8:39 am
If you know the maximum number of iterations, you can use a series of joins as below, otherwise you'll have to use a recursive query.
DECLARE @t TABLE(dnsname VARCHAR(30),alias VARCHAR(30),zone VARCHAR(30));
INSERT...
September 8, 2010 at 4:39 am
In the "Save Grid Results" dialog click on the arrow on the "Save" button, you can set the encoding to ANSI there.
September 7, 2010 at 3:07 pm
Something like this?
DECLARE @t TABLE(name1 VARCHAR(30), type1 VARCHAR(10), name2 VARCHAR(30), type2 VARCHAR(10))
INSERT INTO @t(name1,type1,name2,type2)
SELECT 'Report1','report','table1','table' UNION ALL
SELECT 'Report1','report','view1','view' UNION ALL
SELECT 'report2','report','view2','view' UNION ALL
SELECT 'report2','report','table1','table' UNION ALL
SELECT 'view1','view','table2','table' UNION...
September 7, 2010 at 11:37 am
cidr (9/2/2010)
September 2, 2010 at 2:50 am
SELECT coursecode,
MAX(CASE WHEN attendancetype='L' THEN attendancetime END) AS L,
MAX(CASE WHEN attendancetype='T' THEN attendancetime END) AS T,
...
September 1, 2010 at 7:36 am
WayneS (8/31/2010)
If you also need dates to show if there were zero tickets for all reps for that date, then you need to utilize a calendar...
August 31, 2010 at 11:27 am
WITH Reps AS (
SELECT DISTINCT Rep
FROM TicketDtl)
SELECT h.TicketDate,
r.Rep,
COUNT(d.Rep)
FROM TicketHdr h
CROSS JOIN Reps r
LEFT OUTER JOIN TicketDtl...
August 31, 2010 at 11:01 am
WayneS (8/27/2010)
Jeff Moden (8/26/2010)
August 27, 2010 at 3:56 am
Try this
SET DATEFORMAT YMD
--Sample table
DECLARE @TABLE AS TABLE(
[RID] INT,
[EMID] INT,
[In Time] DATETIME,
[Out Time] DATETIME)
--Insert sample data
INSERT INTO @TABLE
SELECT 62, 12, '2005-08-18 06:02:00', '2005-08-18 06:31:00'
UNION ALL SELECT 63, 12, '2005-08-18 06:31:00',...
August 24, 2010 at 5:28 am
That is a bitwise "AND" and will return rows where both bits 4 and 5 are zero
http://msdn.microsoft.com/en-US/library/ms174965(v=SQL.100).aspx
August 23, 2010 at 7:40 am
Viewing 15 posts - 901 through 915 (of 1,439 total)