How will you collect the date from current date to last
older 6 days date in sql server 2005

Answers were Sorted based on User's Feedback



How will you collect the date from current date to last older 6 days date in sql server 2005..

Answer / gopi muluka

Using DATEADD Function compare get the requited values

SELECT DATEADD(DD,-6,GETDATE())

Is This Answer Correct ?    9 Yes 0 No

How will you collect the date from current date to last older 6 days date in sql server 2005..

Answer / jitendra sharma

SELECT DATEADD(DD,-6,GETDATE()) this is right...........

Is This Answer Correct ?    4 Yes 0 No

How will you collect the date from current date to last older 6 days date in sql server 2005..

Answer / hairlin vasanth raj

ALTER procedure [dbo].[p1]
as
declare
@i int
set @i = 0
begin
set nocount on
while (@i < 6)
begin
SELECT DATEADD(DD,-@i,GETDATE()) as date
set @i=@i+1
end
end


exec p1

Is This Answer Correct ?    1 Yes 0 No

How will you collect the date from current date to last older 6 days date in sql server 2005..

Answer / sreeram

select convert(varchar,cast(dateadd(dd,-6,getdate()) as datetime),101)

ans:09/21/2010

ofcourse the above are also correct

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What are the character string functions supported by sql server 2005?

0 Answers  


How to get last system shutdown time in Sql server when restarted system?

1 Answers  


Write the SQL query to drop, truncate and delete table.

0 Answers   HPCL, Hughes Systique Corporation, Ittiam Systems,


What is a data source or ds? : sql server analysis services, ssas

0 Answers  


What is the difference between stored procedure and functions?

0 Answers   MCN Solutions,






Explain about local stored procedure?

0 Answers  


Explain indexed view?

1 Answers  


How to determine the service pack currently installed on SQL Server?

4 Answers   HCL,


How much is a sql server license?

0 Answers  


To which devices can a backup be created and where should these devices be located? : sql server management studio

0 Answers  


how to rest identity columns in sql server

3 Answers   Matrix,


What is difference between views and stored procedures?

0 Answers  


Categories