Hi prakash.chakrala,
you can try this,
create FUNCTION Dates(@fromdate datetime,@todate datetime)
returns varchar(1000)
as
begin
DECLARE @Count INT
DECLARE @Len INT
Declare @dates varchar(max)
set @count=1;
set @Len= DATEDIFF(Day,@fromdate,@todate)
set @dates=CONVERT(Varchar,@fromdate,105)
while @Count<=@Len
begin
set @fromdate=@fromdate+1;
set @dates=@dates+''','+CONVERT(varchar,@fromdate,105);
set @Count=@Count+1;
end
return @dates
end
select Name,Dates(EnterDate,ToDate)
from table1 (nolock)
where name='manoj'
Hope it will help you...
Happy Coding