易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL Select Into语句


SQL Select Into语句
The SELECT INTO Statement
SELECT INTO 语句
The SELECT INTO statement is most often used to create backup copies of tables or for archiving records.
SELECT INTO语句常用来给数据表建立备份或是历史档案。
Syntax
语法
SELECT column_name(s) INTO newtable [IN externaldatabase] from source
Make a Backup Copy
制作一个备份
The following example makes a backup copy of the "Persons" table:
下面的例子中会为"Persons"表制作一个备份
SELECT * INTO Persons_backupfrom Persons
The IN clause can be used to copy tables into another database:
IN子句可以用来将多个数据表拷贝到另一个数据库上:
SELECT Persons.* INTO Persons IN 'Backup.mdb'from Persons
If you only want to copy a few fields, you can do so by listing them after the SELECT statement:
如果你仅仅想拷贝其中的一部分,可以在SELECT后面列举出它们:
SELECT LastName,FirstName INTO Persons_backupfrom Persons
You can also add a WHERE clause. The following example creates a "Persons_backup" table with two columns (FirstName and LastName) by extracting the persons who lives in "Sandnes" from the "Persons" table:
你还可以加上WHERE子句。在下面的举例中会建立一个"Persons_backup"表,里面包含了在"Persons"表中住在"Sandnes"的个人姓(LastName)与名(FirstName)信息。
SELECT LastName,Firstname INTO Persons_backupfrom PersonsWHERE City='Sandnes'
Selecting data from more than one table is also possible. The following example creates a new table "Empl_Ord_backup" that contains data from the two tables Employees and Orders:
选择多个表进行备份也是可以的。下面的举例就建立了一个新的表"Empl_Ord_backup"里面的数据就有Employees和Orders这两张表的内容:
SELECT Employees.Name,Orders.ProductINTO Empl_Ord_backupfrom EmployeesINNER JOIN OrdersON Employees.Employee_ID=Orders.Employee_ID


相关文档:

sql 列出库中所有表及字段详细信息

--select name from sysobjects where type='U' order by name
SELECT
(case when a.colorder=1 then d.name else '' end) 表名,
-- a.colorder 字段序号,
a.name 字段名,
(case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end) 标识,
(case when (SELECT count(* ......

sql常用语句集锦

--语 句 功 能
--数据操作
SELECT --从数据库表中检索数据行和列
INSERT --向数据库表添加新数据行
DELETE --从数据库表中删除数据行
UPDATE --更新数据库表中的数据
--数据定义
CREATE TABLE --创建一个数据库表
DROP TABLE --从数据库中删除表
ALTER TABLE --修改数据库表结构
CREATE VIEW --创建一个视图
DRO ......

sql数据库命令大全

SQLServer和Oracle的常用函数对比
  1.绝对值
  S:select abs(-1) value
  O:select abs(-1) value from dual
  2.取整(大)
  S:select ceiling(-1.001) value
  O:select ceil(-1.001) value from dual
  3.取整(小)
  S:select floor(-1.001) value
  O:select floor(-1.001) value fr ......

SQL Server 2005/2008 安全监控(待续)

-- 查看当前db的登陆
select * from sys.sql_logins
-- 审核登陆数据库的用户
sql server managerment studio中,右键点开服务器的属性,在安全性页签中, 选中审核“成功和失败的登陆”,所有登陆都会在..MSSQL\Log\ERRORLOG中记录一条记录。
如果勾选“启用C2审核跟踪”,将会在..MSSQL\Log\目录 ......

通过pl/sql 将oracle10数据导入oracle9中


1、  打开pl/sql 中tools-preferences,设置Connection中的Oracle Home为oracle9,OCI library为oracle9 如图
2、
         将oralce10目录下的tnsnames.ora文件里面的所要导出的oralce10的服务配置 复制到oracle9目录下的tnsnames.ora文件里面
ORCL =
  (DESCRIP ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号