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 |
What is difference between rollback immediate and with no_wait during alter database?
tell me what are the steps you will take to improve performance of a poor performing query? : Sql server database administration
how many bits ip address consist of? : Sql server database administration
i want to create procedure for create table in sql server 2005 for example create procedure create_table @table varchar(20) as create @table( id int, name char(20) ) but it will get error what is solution?
Normalization and denormalization
What is the difference between dbcc indexdefrag and dbcc reindex?
What command must you use to include the not null constraint after a table has already been created?
what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration
How to write a script for upate the data in prod , i have 50000 row are there
What is a trigger and its types?
What are user-defined functions (udfs) in sql server?
There is table like Events...in that name ,startdate ,enddate,location are the column names write a stored Procedure for this table to get events by Months "GetEventsByMonths"
Oracle (3253)
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)