Viewing 15 posts - 751 through 765 (of 1,114 total)
Jason,
Its working perfectly. Thanks a lot.:)
Really your help is very much useful for me. So once again My hearty thanks to you.:)
April 29, 2008 at 8:46 am
Jason,
I will check it and come back to you.:)
April 29, 2008 at 8:24 am
Jason,
Thanks a lot for your prompt reply.
Sure. I am using sql2000. I think your query will work in sql2005 only.
Once again my hearty thanks to you.
April 29, 2008 at 8:02 am
Jeff,
Thanks a lot for your help!
I have purified one more time.
DECLARE @DateStart DATETIME
DECLARE @DateEnd DATETIME
SELECT @DateStart = '07/Apr/2008', @DateEnd = '29/Dec/2008'
SELECT Month = convert(varchar,DatePart(MM,DATEADD(mm,N-1,@DateStart))),
...
April 29, 2008 at 7:52 am
Jeff,
I have refined the above code as
DECLARE @DateStart DATETIME
DECLARE @DateEnd DATETIME
SELECT @DateStart = '04/Apr/2007', @DateEnd = '29/Apr/2008'
SELECT convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N-1,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N-1,@DateStart))),103),
DateAdd(DD,-1,convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N,@DateStart))),103))
FROM dbo.Tally
where DateAdd(DD,-1,convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N,@DateStart))),103)) <= @DateEnd
I got the below output:
Apr ...
April 29, 2008 at 6:38 am
Jeff,
DECLARE @DateStart DATETIME
DECLARE @DateEnd DATETIME
SELECT @DateStart = '04/Apr/2007', @DateEnd = '29/Apr/2008'
SELECT convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N-1,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N-1,@DateStart))),103),
DateAdd(DD,-1,convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N,@DateStart))),103))
FROM dbo.Tally
Above code is working fine. But it is running like a car without break:). Yes,It...
April 29, 2008 at 6:17 am
i have executed the below statements.
select dateadd(mm,0,0)
select dateadd(mm,0,-1)
I got the following error.
Function DATEADD invoked with wrong number or type of argument(s).
select datediff (yy, "1984", 0)
Function DATEDIFF invoked with wrong number...
April 29, 2008 at 5:31 am
Jason,
I want to generate the last date for each month.
Select @year = min(Year)
From PRREQ
...
April 29, 2008 at 4:21 am
Jeff,
It is not working. I got the below error message.
Function DATEDIFF invoked with wrong number or type of argument(s).
But when i execute it seperately like
select DATEDIFF(MM,'01/apr/2007','01/apr/2008')
its showing 12.
Please help...
April 29, 2008 at 2:48 am
First off, if @abc is varchar, then -1 isn't a valid value, although '-1' is.
Just i tried to ask explanation for the above one.
April 28, 2008 at 9:20 am
First off, if @abc is varchar, then -1 isn't a valid value, although '-1' is.
I do agree with you. I made mistake.
April 28, 2008 at 8:47 am
SQL Server 2005 to use FOR XML PATH('').
But i am using sql2000.
April 25, 2008 at 6:19 am
I am also thought to use WHILE LOOP.
Adrian, do you think is there any performance wise difference between using CURSOR and WHILE loop ?
Please share your thoughts.
April 25, 2008 at 6:18 am
How many rows does this table have?
50000 rows.
Hom many rows are there maximum (if there is a maximum) does each employee have?
10-15
April 25, 2008 at 5:50 am
Viewing 15 posts - 751 through 765 (of 1,114 total)