内容导航:
1、
declare cursor
2、
sql server中查询所有表的创建和修改时间?
1、
declare cursor
英:
美:
常见释义:
声明游标
1、remote database is just specified in the DECLARE CURSOR statement using the database option.───只需使用DATABASE选项在DECLARE cursor语句中指定远程数据库。
2、If the query expression is part of a DECLARE CURSOR statement, column_alias cannot be used in the FOR UPDATE clause.───如果查询表达式是DECLARECURSOR语句的一部分,则不能在DECLARECURSOR中使用column_alias。
3、Use a DECLARE cursor statement to define a cursor over the evaluation of the query.───使用 DECLARE CURS OR 语句在查询的评估上定义一个游标。
4、The DECLARE CURSOR statement is the root of the graphical execution plan tree, with its related statement as a child or node.───DECLARECURSOR语句是图形执行计划树的根,与之相关的语句为子级或节点。
5、An application should only execute DECLARE CURSOR if it has set all the API cursor attributes back to their defaults.───应用程序只有在将所有的API游标特性设置回默认值后,才可以执行DECLARECURSOR。
6、DECLARE CURSOR permissions default to any user that has SELECT permissions on the views, tables, and columns used in the cursor.───默认情况下,将DECLARECURSOR权限授予对游标中所使用的视图、表和列具有SELECT权限的任何用户。
7、With the DECLARE CURSOR command, a cursor is defined that reads all data of the source table SALES using a trivial SELECT statement.───使用DECLARECURSOR命令定义一个游标,它使用SELECT语句读取源表SALES的所有数据。
8、Is the name of a cursor created by a DECLARE CURSOR statement that either has the LOCAL keyword or that defaulted to LOCAL.───由具有LOCAL关键字或默认设置为LOCAL的DECLARECURSOR语句创建的游标名称。
9、Definition of the required cursor does not occur separately by executing DECLARE cursor.───不需要通过执行DECLARE CURSOR单独定义所需的游标。
1、hereby declare───特此声明
2、cursor io───光标io
3、cursor───n.光标;(计算尺的)【计】游标,指针
4、cursor game───光标游戏
5、declare───vt.宣布,声明;断言,宣称;vi.声明,宣布
6、declare oneself───v.发表意见,显露身份; 抒发己见;显露身分;发表意见
7、leading declare───前导声明
8、cursor extension───光标扩展
9、cursor customizer───光标自定义程序
2、
sql server中查询所有表的创建和修改时间?
这个存储过程将列出数据库的所有表的创建时间:
Create proc usp_alldatabases
as
begin
declare @script as nvarchar(2000)
if exists(select 1 from sysobjects where name=tab_alltables) drop table tab_alltables
create table tab_alltables (db nvarchar(1000), tab nvarchar(1000),cdate datetime)
declare c cursor for
select insert into tab_alltables (tab,db,cdate) select name,+name+ ,crdate from +name+..sysobjects where xtype=u from master..sysdatabases where dbid>4
open c
fetch c into @script
while @@fetch_status=0
begin
exec (@script)
print @script
fetch c into @script
end
close c deallocate c
select * from tab_alltables --You can add your criteria here to serach for a particular table name
end
这个SP将产生三列:
1) db: 数据库名称
2) tab : 表名称
3) cdate: 表的创建时间
转