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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain multiserver query

552


What are the advantages of mirroring?

569


What is the data tier application?

145


What are the advantages of log shipping?

561


Mention the uses of stored procedures.

566






What are the types of sql server?

517


What is “begin trans”, “commit tran”, “rollback tran” and “savetran”?

582


How to list all dsn entries on your local machine using odbc_data_source()?

555


How global temporary tables are represented and its scope?

547


What are triggers? How do you invoke a trigger on demand?

746


Explain the difference between HTTP and HTTPS in database?

560


What is a fill factor?

618


How to Improve the performencs of SQL Server 2005 exclude stored Procedure and Indexes?

1574


What is normalization of database? What are its benefits?

515


You have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation?

481