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 different types of database indexes?

0 Answers  


write coding for importing sql data into a word excel...

1 Answers   Oracle,


What does asynchronous call backs means?

0 Answers   Alcatel-Lucent,


Write the Syntax for Cursors.

2 Answers   CarrizalSoft Technologies, HP,


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

0 Answers  






What is the difference between a primary key and a unique key? Are they the same?

0 Answers  


How do you start single user mode in clustered installations?

0 Answers  


Magic Tables ?

2 Answers   Thomson Reuters,


What is data mart? : sql server analysis services, ssas

0 Answers  


How do I create a trace in sql server?

0 Answers  


What is the purpose of data source?

0 Answers  


what is the difference between a primary key and a unique key? : Sql server database administration

0 Answers  


Categories