Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Table Updated Time And Date

Author  Topic 

VANISHREE.B
Starting Member

3 Posts

Posted - 2009-03-04 : 01:46:36
HI All,
Am New To sql server , i want to know how to get the last updated time and date ,am using below given query To get the tablename and column can any one tell me how do i get the time and date as well,


SELECT syscolumns.id, sysobjects.name AS TableName, syscolumns.name AS Columnname, sysobjects.crdate, syscolumns.colid
FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id WHERE (sysobjects.xtype = 'U') ORDER BY sysobjects.name, syscolumns.colid


Is there any way i can get this..Thanks in Advance


VANISHREE.B

sridhar.dbe
Starting Member

34 Posts

Posted - 2009-03-04 : 04:06:50
is this what you want?

select c.id,
s.name AS TableName,
c.name AS Columnname,
s.create_date,
s.modify_date,
c.colid
from sys.objects as s
inner join sys.syscolumns as c ON s.object_id = c.id
where (s.type = 'U') ORDER BY s.name, c.colid
or
select * from sys.tables order by modify_date desc




isk
Go to Top of Page

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-03-04 : 05:41:51
Do you want some thing like this.

SELECT sc.id, st.name AS TableName, sc.name AS Columnname, st.modify_date, sc.colid
FROM sys.tables st JOIN
syscolumns sc ON st.object_id = sc.id
ORDER BY st.name, sc.colid

Karthik
Go to Top of Page

VANISHREE.B
Starting Member

3 Posts

Posted - 2009-03-04 : 23:44:49
hey hi Karthik,

When i try to exceute query it's give me error, "Invalid object name 'sys.tables'." As far as i know this error means sys.tables does not exists in my database



VANISHREE.B
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-03-05 : 01:52:33
Are you using SQL Server 2000?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

VANISHREE.B
Starting Member

3 Posts

Posted - 2009-03-05 : 04:39:58
s am using sql server 2000 only is there any solution for my question..

VANISHREE.B
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-03-05 : 05:00:56
This helps ?

select object_name(sysobjects.id),(syscolumns.name) from sysobjects join syscolumns on  sysobjects.id=syscolumns.id order by refdate desc
Go to Top of Page
   

- Advertisement -