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

How to get a list of table columns using the "sp_columns" stored procedure in ms sql server?

0 Answers  


How do you drop an index?

0 Answers  


What is the difference between having clause and where clause in sql server?

0 Answers  


How do you check the performance of a query and how do you optimize it?

1 Answers  


How to transfer an existing table from one schema to another schema in ms sql server?

0 Answers  






When a primary key constraint is included in a table, what other constraints does this imply?

0 Answers  


how would you troubleshoot blocking? : Sql server database administration

0 Answers  


What is the use of group by clause?

0 Answers  


sql database suspect We have a sql database that is showing as suspect. How can we recover?

0 Answers  


About Indexed Views? with example? plz reply...

2 Answers  


Explain filtered indexes benefits?

0 Answers  


What is difference between drop truncate and delete?

0 Answers  


Categories