Viewing 8 posts - 1 through 8 (of 8 total)
You can get more info about them in Books On Line(BOL) by studying window functions.
August 16, 2011 at 4:26 am
try thisSET NOCOUNT ON
DECLARE @score TABLE (
[PlayerId] [INT] IDENTITY(1,1) NOT NULL,
[PlayerName] [VARCHAR](50) NULL,
[PlayerScore] [INT] NULL,
[ScoreDate] [VARCHAR](30) NULL,
[overs] [INT] NULL)
INSERT INTO @score VALUES('sunil',5,'16-08-2011',1)
INSERT INTO @score VALUES('sunil',8,'16-08-2011',2)
INSERT INTO @score VALUES('sunil',13,'16-08-2011',3)
INSERT INTO @score...
August 16, 2011 at 2:30 am
The prob is with case stmt.
CASE
WHEN a.member_period = 1 THEN '2079-06-06'
...
February 25, 2011 at 1:53 am
Using PIOVT its not possible to have more than 1 column in output. U need to use old style "Cross Tax" like
SELECT CustomerName,
SUM(CASE WHEN MONTH(fdata) = 1...
February 23, 2011 at 12:09 am
As i have used XML for splitting the values it breaks if there are any special chars. I modified the code to split based on numbers table rather xml.
And the...
February 22, 2011 at 11:41 pm
I modified the code to fix the issue. ( Assumption is after every 3 commas(,) new set begins)
SET NOCOUNT ON
DECLARE @T_Data TABLE
(
...
February 20, 2011 at 9:12 pm
Not sure abt performance. Replace table variables with temp tables with indexes for large data. Try this SET NOCOUNT ON
DECLARE @T_Data TABLE
(
ID INT IDENTITY(1, 1), Data NVARCHAR(MAX)
)
INSERT INTO @T_Data
SELECT ',2...
February 18, 2011 at 12:28 am
try thisDECLARE @Date DATETIME
SELECT @Date = '2011-01-01'
SELECT Date FROM (
SELECT Number
, DATEADD(DAY, number, @Date) AS DATE
, ROW_NUMBER() OVER (PARTITION BY MONTH(DATEADD(DAY, number, @Date)), YEAR(DATEADD(DAY, number, @Date))
ORDER BY DATEADD(DAY, number, @Date))...
February 17, 2011 at 9:42 pm
Viewing 8 posts - 1 through 8 (of 8 total)