SQL语句导入导出大全
/******* 导出到excel
exec master..xp_cmdshell ’bcp settledb.dbo.shanghu out c:\temp1.xls -c -q -s"gnetdata/gnetdata" -u"sa" -p""’
/*********** 导入excel
select *
from opendatasource( ’microsoft.jet.oledb.4.0’,
’data source="c:\test.xls";user id=admin;password=;extended properties=excel 5.0’)...xactions
select cast(cast(科目编号 as numeric(10,2)) as nvarchar(255))+’ ’ 转换后的别名
from opendatasource( ’microsoft.jet.oledb.4.0’,
’data source="c:\test.xls";user id=admin;password=;extended properties=excel 5.0’)...xactions
/** 导入文本文件
exec master..xp_cmdshell ’bcp dbname..tablename in c:\dt.txt -c -sservername -usa -ppassword’
/** 导出文本文件
exec master..xp_cmdshell ’bcp "dbname..tablename" out c:\dt.txt -c -sservername -usa -ppassword’
此句需加引号
或
exec master..xp_cmdshell ’bcp "select * from dbname..tablename" queryout c:\dt.txt -c -sservername -usa -ppassword’
导出到txt文本,用逗号分开
exec master..xp_cmdshell ’bcp "库名..表名" out "d:\tt.txt" -c -t ,-u sa -p password’
bulk insert 库名..表名
from ’c:\test.txt’
with (
fieldterminator = ’;’,
rowterminator = ’\n’
)
--/* dbase iv文件
select * from
openrowset(’microsoft.jet.oledb.4.0’
,’dbase iv;hdr=no;imex=2;database=c:\’,’select * from [客户资料4.dbf]’)
--*/
--/* dbase iii文件
select * from
openrowset(’microsoft.jet.oledb.4.0’
,’dbase iii;hdr=no;imex=2;database=c:\’,’select * from [客户资料3.dbf]’)
--*/
--/* foxpro 数据库
select * from openrowset(’msdasql’,
’driver=microsoft visual foxpro driver;sourcetype=dbf;sourcedb=c:\’,
’select * from [aa.dbf]’)
--*/
/**************导入dbf文件****************/
select * fr
相关文档:
系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......
查询 card 的记录为两次以上的 card,记录数:
select count(card), card from TableName group by card having count(card) > 1
级联更新,级联删除:
ColumnName type not null constraint FK_Name foreign key(ColumnName) references PrimaryTable(ColumnName) on update/delete cascade
自动计算列:
create tabl ......
Knowledge Xpert® for PL/SQL 是一个功能强大的基于Windows的技术资源库,它覆盖PL/SQL 开发的整个生命周期,上千种专题提供编写高质量代码所需要的背景信息、最好的经验和程序范例。
提供上千种专题,覆盖PL/SQL 编程的整个生命周期,从基本的专题到高级的PL/SQL 编码技术。
由包括Mike Ault、Steven Feuerstein、 ......
PL/SQL存储过程编程 收藏
/**author huangchaobiao
*Email:huangchaobiao111@163.com
*/
PL/SQL存储过程编程(上)
1. Oracle应用编辑方法概览
答:1) Pro*C/C++/... : C语言和数据库打交道的方法,比OCI更常用;
2) ODBC
3) OCI: C语言和数据库打交道的方法,和ProC很相似,更底层,很少用;
4) SQLJ ......