abhas
SSCarpal Tunnel
Points: 4681
More actions
August 8, 2014 at 12:05 am
#310555
Hi,
I am having query where i am calulating datediff value, but i want to display resultser as below:
if datediff = 4 then resultset would be
0
1
2
3
4
if datediff = 9 then
5
6
7
8
9
how can i implement this?
Thanks
ABhas,
Umer Akram
SSC-Insane
Points: 22209
August 8, 2014 at 12:18 am
#1736294
Sample data and Desire Output will be very helpful to understand the problem and its solution.
Sean Pearce
SSCoach
Points: 15999
August 8, 2014 at 7:25 am
#1736401
WITH CTE AS (
SELECT TOP 10000
ROW_NUMBER() OVER (ORDER BY a.object_id) - 1 AS RowNbr
FROM
sys.all_columns a
CROSS JOIN
sys.all_columns b)
SELECT
RowNbr
CTE
WHERE
RowNbr <= DATEDIFF(HOUR, '2014-08-07 10:00', '2014-08-07 18:00')
The SQL Guy @ blogspot[/url]
@SeanPearceSQL
About Me[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply