表中特定列的修改日期 [英] Modified date of particular column in a table

查看:81
本文介绍了表中特定列的修改日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个名为(产品)的SQL TABLE



最初我创建了在01 / Jan / 13上有2列(COL1 int,COL2 varchar(20))。

后来我在05 / Jan / 13上添加了新列COL3 VARCHAR(20)但是我改变了数据类型2013年1月7日,COL3作为Int。我想要一个查询列出列名,创建日期和修改日期。





查询输出应该是:



Column_name< - > create_date< - > Modifieddate

COL1< - > 01 /月/ 13< - > 01 / Jan / 13

COL2< - > 01 /月/ 13< - > 01 / Jan / 13

COL3< - > 05 /月/ 13< - > 07 / Jan / 13

Hi,

I Have a SQL TABLE called (PRODUCT)

Initially i have create with 2 columns(COL1 int,COL2 varchar(20)) on 01/Jan/13.
Later on i added new column COL3 VARCHAR(20) on 05/Jan/13.But i altered datatype of COL3 as Int on 07/01/13. I want a query for list out the column name ,created date and modified date.


Query out put should be:

Column_name <-->create_date<-->Modifieddate
COL1<--> 01/Jan/13<--> 01/Jan/13
COL2<--> 01/Jan/13<--> 01/Jan/13
COL3<--> 05/Jan/13<--> 07/Jan/13

推荐答案

正如我在2008年所怀疑的那样,没有用于跟踪表格更改的sys表条目 - 请参阅

http://stackoverflow.com/questions/6344413/sqlserver-row-date-last-modified [ ^ ]



如果你真的想要这个功能,你必须自己使用DDL触发器构建它 - 看看

http://www.sqlteam.com/article/using -ddl-triggers-in-sql-server-2005-to-capture-schema-changes [ ^ ]



< a href =htt号码://www.simple-talk.com/sql/database-administration/auditing-ddl-changes-in-sql-server-databases/> http://www.simple-talk.com/sql/database-管理/审计-ddl-changes-in-sql-server-databases / [ ^ ]

或升级/更改工具
As I suspected in 2008 there is no sys table entry for tracking changes to tables in this way - see
http://stackoverflow.com/questions/6344413/sqlserver-row-date-last-modified[^]

If you really want this functionality you''ll have to build it yourself using DDL triggers - have a look at
http://www.sqlteam.com/article/using-ddl-triggers-in-sql-server-2005-to-capture-schema-changes[^]
or
http://www.simple-talk.com/sql/database-administration/auditing-ddl-changes-in-sql-server-databases/[^]
or upgrade / change tools


这篇关于表中特定列的修改日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆