python抛出所有异常信息

摘要: 有时候为了调试方便需要格式化所有的异常信息,方式如下except Exception as e: for artt in dir(e): rmsg = rmsg + artt + ':' + str(getattr(e, artt)) + '\r\n' 阅读全文
posted @ 2012-01-10 18:21 trams 阅读(1763) 评论(0) 推荐(0)

update statistics伪造统计信息

摘要: 当我们想要分析某些语句在一定数据量后的执行计划情况是可能会进行数据的模拟,伪造大量的数据。但其实这个工作挺费劲了,经朋友介绍在网上看到下面这种伪造统计信息的方式,对于如果只是分析执行计划的情况很方便。use tempdbgocreate table t1(i int, j int)gocreate table t2(h int, k int)goset statistics profile ongoselect distinct(i) from t1goselect * from t1, t2 where i = k order by j + kgoupdate statistics t1 w 阅读全文
posted @ 2012-01-10 11:06 trams 阅读(287) 评论(0) 推荐(0)

sp_rename修改对象名称

摘要: create table test(username varchar(10), userinfo varchar(200), primary key (username) ) go --修改字段名 exec sp_rename 'test.userinfo', 'userdesc', 'column'; go sp_help test go --修改表名 exec sp_rename 'test', 'test1', 'object'; go sp_help test1 go --sp_rename 阅读全文
posted @ 2012-01-10 11:04 trams 阅读(508) 评论(0) 推荐(0)