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
What happens if the update subquery returns no rows in ms sql server?
How do I edit a stored procedure in sql server?
Which sql server table is used to hold the stored procedure script?
if you encounter this kind of an error message, what you need to look into to solve this problem? : Sql server database administration
What are system databases into sql server (2005/2008)?
What is the contrast between sql and pl/sql?
Do you know what are the differences between lost updates and uncommitted dependencies?
What is the use of keyword with encryption. Create a store procedure with encryption?
What is user defined stored procedures?
What is the name of the system variable that returns the number of rows affected by a SQL statement?
Explain transaction server implicit?
you notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it? : Sql server administration
What is difference between commit and rollback when used in transactions?
What is the difference between dbcc indexdefrag and dbcc reindex?
Are null values the same as that of zero or a blank space?