SQL常用的小方法
1、--- 取得与表名相关的存储过程、方法、函数
selecT A.* from sysobjects A, syscomments B where a.id= B.id and b.text like '%你的表名%'
--------一定要like '%..%' 这样 要不查询不出任何东西来
2、--取得一个表的所有的字段名(下面两个的效果是一样的)
select name from syscolumns where id=object_id('表名')
select name from syscolumns where id in (select id from sysobjects where type = 'u' and name = '表名')
3、---查询当前数据库的所有的存储过程名
select name as 存储过程名称 from sysobjects where xtype='P'
4、--查询一个表的所有的字段的类型,定义
select * from information_schema.columns where table_name = '表名'
—————————————————————————————————————————————你可以不伟大,但不可以不优秀!
浙公网安备 33010602011771号