sql query

zolf
zolf used Ask the Experts™
on

hello there,

i want to know how can i write a query which will return me the rows which have got edited today.
for e.g.

SELECT * FROM table WHERE editdate= today

and can i get all the rows that got edited without editdate col for e.g.

SELECT * FROM table
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Hi ,
    If you are mentaining one column [editdate] (Data Type should be datetime) in this table.
so,
SELECT * FROM table WHERE editdate=getdate()

Commented:
Is this what you are after:

Select column1,column2,column2,column4 where editdate= Date()

Author

Commented:

mimran18:

thanks it helped me to get the records using getdate().what if edittable is not date type.is there any way to know which records were edited in a table

sb9:
error when i run your query
Msg 195, Level 15, State 10, Line 4
'Date' is not a recognized built-in function name.
Commented:
Zolf :
       Most Welcome,we need to maintain datetime (timestamp) in any column of the table.
same defined here as well :http://forums.whirlpool.net.au/archive/1671005

Author

Commented:
thanks

Author

Commented:

i am facing an issue,when i say updatedDate=getdate,it does not return anything even though i have a updated record today. what is wrong, does it take into consideration the time also.how can i only get the date and excude the time factor.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial