利用pl/sql执行本地的sql文件中的sql语句
功能:pl/sql执行本地的sql文件中的sql语句
说明:比如:e:\zhaozhenlong下有create_table.sql文件,则按如下方法执行:
步骤:
1、在pl/sql的command window下,
或在windows的开始/'运行'下,sqlplus /nolog; connect cs@orademo;
2、执行:
@@e:\zhaozhenlong\drop_table.sql
@@e:\zhaozhenlong\create_table.sql
/*
说明:.sql文件名字中不能有空格,
如create_table.sql是合法的,create table.sql是非法的。
文件内容:
drop_table.sql文件内容:
drop table tb_zhaozhenlong6;
drop table tb_zhaozhenlong5;
create_table.sql文件内容:
--drop table tb_zhaozhenlong5;
create table tb_zhaozhenlong5(
c1 varchar2(10) not null constraint pk_zhaozhenlong5 primary key,
c2 varchar2(10) not null ,
c3 varchar2(10) not null constraint un_zhaozhenlong5 unique,
c4 char(1) not null constraint ck_zhaozhenlongddd check(c4 in('0','1')) ,
c5 char(1) not null,
constraint un_zhaozhenlong51 unique(c1,c2),
constraint ch_zhaozhenlong51 check(c5 in('Y','N'))
);
--drop table tb_zhaozhenlong6;
create table tb_zhaozhenlong6(
c1 varchar2(10) not null, constraint fk_zhaozhenlong6 foreign key(c1) references tb_zhaozhenlong5(c1),
c2 varchar2(10) not null,
&nb
相关文档:
SQL Server 几个好用的SQL语句
1、复制表
select * into desttable from srctable
将 srctable 完整地复制一份到 desttable 中,当然后面也可以加上条件来限定需要复制的记录
要求:desttable 必须为不存在的表名。
insert into desttable(column1, column2) select columna, columnb from sr ......
知: 字段A='F:\photo\Winter Leaves.jpg'
要求:分段截取每段字符[字段A不能为TEXT类型,否则报错]
解决方法:
---截取字符串A的第一个\左边的字符串
select left(A,charindex('/',A)-1)
输出结果:F:
---截取\中间的字符串
select left(stuff(A,1,charindex('/',A),''),charindex('/',stuff(A,1,c ......
一、什么是SQL注入式攻击?
所谓SQL注入式攻击,就是攻击者把SQL命令插入到Web表单的输入域或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令。在某些表单中,用户输入的内容直接用来构造(或者影响)动态SQL命令,或作为存储过程的输入参数,这类表单特别容易受到SQL注入式攻击。常见的SQL注入式攻击过程类如:
⑴ ......
一、表的导入导出语句及时间字符串部分处理函数
导出数据库所有表的结构 mysqldump -uroot -proot db_name -d > d:/export_db.sql(结尾不用分号)
导出数据库某个表的结构 mysqldump -uroot -proot db_n ......
转自http://www.111cn.cn/database/109/b992816b1dddbb641c25c0999883427e.htm
declare @text nvarchar(max);
with tb
as
(
select blocking_session_id,
session_id,db_name(database_id) as dbname,text from master.sys.dm_exec_requests a
CROSS APPLY master.sys.dm_exec_sql_text(a.sql_handle)
),
tb1 a ......