Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to write a sybase query for how to get a last modified column and timestamp for all the tables in SYBASE database. Please find the sql below. but this is not accuarte one.. it is working in one syabase DB object and not in another environment. Please help me with proper sql.
SQL
select 
  TableName=object_name(ss.id), 
  RowCnt=st.rowcnt,
  ColName=col_name(ss.id,convert(int,substring(ss.colidarray,1,2))),
  UpdStatsDate=convert(varchar(20),moddate,100),
  DaysAgo=datediff(dd,moddate,getdate())
from 
  sysstatistics ss, systabstats st
where 
  ss.id > 100 
  and st.id > 100
  and ss.id=st.id
  and ss.formatid=100
  and st.indid in (0,1)
  and ss.c4 is not null
order by 
  TableName, ColName
Posted
Updated 4-Jan-15 22:42pm
v4
Comments
yadlaprasad 5-Jan-15 4:30am    
Hi, Please find below query.. but this is not accurate one.. I need some proper sql.. Please help..

select TableName=object_name(ss.id), RowCnt=st.rowcnt,
ColName=col_name(ss.id,convert(int,substring(ss.colidarray,1,2))),
UpdStatsDate=convert(varchar(20),moddate,100),
DaysAgo=datediff(dd,moddate,getdate())
from sysstatistics ss, systabstats st
where ss.id > 100 and st.id > 100
and ss.id=st.id
and ss.formatid=100
and st.indid in (0,1)
and ss.c4 is not null
order by TableName, ColName
Kornfeld Eliyahu Peter 5-Jan-15 4:33am    
Please update your question, using 'Improve question'...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900