用SHELL的循环批量执行SQL语句
--ksh下的一个WHILE 循环的例子
integer i=1
while ((i<67))
do
pirnt $i
i=i+1
done
--ksh 下一个FOR循环的例子
for i in `cat listdate.txt`
do
echo "执行 $i "
done
--- date.pl 用于生成一个时间段文件
#!/usr/local/bin/perl
use DBI;
if($#ARGV<1)
{
die "USAGE:date.pl <startdate> <enddate> \n";
return(0);
}
$rundate1=$ARGV[0];
$rundate2=$ARGV[1];
$dbh=DBI->connect('dbi:Oracle:host=192.xx.xx.2;sid=ora7','report/system','')||
die('cann\'t connect to database');
$date=$dbh->prepare("select cal_date from calendar where cal_date between to_date(?,'yyyymmdd') and to_date(?,'yyyymmdd')");
$date->bind_param( 1, $rundate1);
$date->bind_param( 2, $rundate2);
$date->execute;
while (@row = $date->fetchrow_array)
{
printf("$row[0]\n");
}
$dbh->disconnect;
---实例 批处理执行一段时间 每天 要执行的程序
date.pl 20100101 20100307 > listdate.txt
for i in `cat listdate.txt`
do
echo "执行 $i "
sqlplus cust/cust @cust_get_jf_md2010.sql $i
done
相关文档:
一、SQL Server中数据行的存储方式
在SQL Server中存放数据的文件会以8KB的大小分页。每一页可以是数据、索引以及其他SQL Server数据库需要为其维护数据文件的数据类型。大多数页是数据页或索引页。页是SQL Server读、写数据文件的单元。每一页只包括一个对象的数据或索引信息,所以在每一个数据 ......
Student(S#,Sname,Sage,Ssex) 学生表
Course(C#,Cname,T#) 课程表
SC(S#,C#,score) 成绩表
Teacher(T#,Tname) 教师表
问题:
1、查询“001”课程比“002”课程成绩高的所有学生的学号;
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
fr ......
ASP.NET Excel导入到SQL Server数据库
提供把Excel里的数据导入到SQL Server 数据库,前提是Excel里的字段在Sql Server表里都有,不然会出现错误。注释很详细哦!要引用的命名空间是:
using System.Data.OleDb;
using System.Data.SqlClient;
//操作类
public class ExcelToSQL
{
& ......
sql server 临时表的使用 以及给临时表插入主键列
--某时间段内某组服务器的消费排行
CREATE PROCEDURE biling_order_consume
@begin_date datetime,
@end_date datetime
AS
select identity(int,1,1) as ID,charge_credit into #tmp from crm_biling
where @begin_date <= convert(datetime,convert( ......
用户、组或角色′sde'在当前数据库中已存在
Use dbName
go
sp_change_users_login ‘update_one’
,
‘loginName’
, ‘loginName‘
摘自:http://www.softbunny.net/post/SQL_Login_User.shtml
......