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
Answer / gopi muluka
Using DATEADD Function compare get the requited values
SELECT DATEADD(DD,-6,GETDATE())
| Is This Answer Correct ? | 9 Yes | 0 No |
Answer / jitendra sharma
SELECT DATEADD(DD,-6,GETDATE()) this is right...........
| Is This Answer Correct ? | 4 Yes | 0 No |
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 |
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 |
Can we drop user if user mapped to any logins
How to enter comments in transact-sql statements?
What is the STUFF function and how does it differ from the REPLACE function?
Which system table contains information on constraints on all the tables created?
CREATE a table from another table
Can we execute a stored procedure inside a trigger?
6 Answers BirlaSoft, CarrizalSoft Technologies, United Healthcare,
What is difference between join and natural join?
how do you test proper tcp/ip configuration windows machine? : Sql server database administration
Which sql server table is used to hold the stored procedure scripts?
A left outer join B B right outer join A gives the same result then what is the use of two?
What is an index. What are the types?
Explain Active/Active and Active/Passive cluster configurations?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)