注:数据表所有字段说明其实都是都存放在sys.extended_properties这个表里面的,本文采用游标跟系统函数获取所有表字段说明文字--声明变量
declare @TableName nvarchar(250)
--声明一个游标mycursor,select语句中参数的个数必须要和从游标取出的变量名相同
declare mycursor cursor for select name from sys.tables order by name
--打开游标
open mycursor
--从游标里取出数据赋值到我们刚才声明的变量中
fetch next from mycursor into @TableName
--判断游标的状态
--0 fetch语句成功
---1 fetch语句失败或此行不在结果集中
---2被提取的行不存在
while (@@fetch_status=0)
begin
--显示出我们每次用游标取出的值
--print "游标成功取出一条数据"
--print @TableNameSELECT * FROM ::fn_listextendedproperty (NULL, "user", "dbo", "table", @TableName, "column", default) where objname="spid";--print "EXEC dbo.aaa_lzq_getstr @TableName = "+@TableName
--用游标去取下一条记录
fetch next from mycursor into @TableName
end
--关闭游标
close mycursor
--撤销游标
deallocate mycursorSQL删除数据库中所有用户数据表外键Oracle通过dblink连接到多台MySQL相关资讯 SQL语句
- 如何定位SQL语句在共享池里用到了 (03月17日)
- Java 注解入门 自动生成SQL语句 (07/28/2015 16:08:34)
- Oracle 通过sql profile为sql语句 (05/03/2015 19:43:07)
| - MySQL 存储过程动态执行sql语句 (10/13/2015 19:10:08)
- 画图解释 SQL join 语句 (07/17/2015 15:16:27)
- MySQL数据库sql语句调优 (03/21/2015 17:42:45)
|
本文评论 查看全部评论 (0)