merge into when matched then... when not mached then... merge into t_road_pre_parameter a from dual ) b on (a.TIME_SEGMENT=? and a.ROAD_ID=? and a.RS_INDEX=? and a.FLAG=) when matched then update set a.week_num=?, a.temperature = ?, a.if_rain…
从外部EXCEl文件导入sqlserver数据库操作命令 reconfigure reconfigure go select * into abc1_1 from OPENROWSET('MICROSOFT.JET.OLEDB.4.0' ,'Excel 5.0;HDR=YES;DATABASE=文件路径',SQLResults$) 注意:文件路径到excel下某个固定的sheet,sheet名字不要有空格 数据库合并 insert into [新数据库名(合并后的)] select [字段] F…
1.查询安装的排序规则选项喝当前的排序规则服务器属性 select * from fn_helpcollations(); 2.查看当前服务器的排序规则 select serverproperty('Collation') as ServerCollation; 3.修改数据库DB1的排序规则,使他区分大小写 create database DB1 go alter database DB1 collate SQL_Latin1_General_CP1_CS_AS; go select data…
以下内容根据此官方文档修改:http://technet.microsoft.com/zh-cn/library/ms189336(v=sql.105).aspx 嵌套事务的使用场景或者说目的主要是为了调用包含了事务的存储过程.不然没必要使用嵌套事务. 下列示例显示了嵌套事务的用途.在TransProc 存储过程中包含事务,在另外的代码中分别启动事务调用TransProc和不启动事务调用TransProc. SET QUOTED_IDENTIFIER OFF; GO SET NOCOUNT OF…
做个记入就好 USE [master] SELECT bs.database_name AS 'Database Name', bs.backup_start_date AS 'Backup Start', bs.backup_finish_date AS 'Backup Finished', DATEDIFF(MINUTE, bs.backup_start_date, bs.backup_finish_date) AS 'Duration (min)', bmf.physical_device…
1 PL/pgSQL Under the Hood This part discusses some implementation details that are frequently important for PL/pgSQL users to know. 1.1 Variable Substitution SQL statements and expressions within a PL/pgSQL function can refer to variables and paramet…
Cursors Rather than executing a whole query at once, it is possible to set up a cursor that encapsulates the query, and then read the query result a few rows at a time. A more interesting usage is to return a reference to a cursor that a function has…
Control Structures of PL/SQL Control structures are probably the most useful (and important) part of PL/pgSQL.With PL/pgSQL's control structures, you can manipulate PostgreSQL data in a very flexible and powerful way. 1.Returning From a Function RETU…
1.Structure of PL/pgSQL The structure of PL/pgSQL is like below: [ <<label>> ] [ DECLARE declarations ] BEGIN statements END [ label ]; A label is only needed if you want to identify the block for use in an EXIT statement, or to qualify the na…
http://blog.csdn.net/sqlserverdiscovery/article/details/7712068 Column name Data type Description blocked smallint ID of the session that is blocking the request. If this column is NULL, the request is not blocked, or the session information of…
本文主要摘自徐海蔚的<Microsoft SQL SERVER企业级平台管理实践> 表变量可以作为存储过程的返回参数,而临时表不行.(存疑?表值参数只在SQL SERVER2008才开始支持,并且限制很多,要首先定义表类型) use [test] go create type [user] as table(id int,name varchar(50)); go create procedure test_prd @u [user] readonly as begin select * fr…
1. linux下快速安装MariaDB: MariaDB 是 一个采用 Maria 存储引擎的 MySQL 分支版本,是由原来 MySQL 的作者 Michael Widenius 创办的公司所开发 的免费开源的数据库服务器 . 本文介绍了在linxu下一个简单的安装 方法(在OpenSuse下测试成功): (摘自:http://www.2cto.com/database/201307/229102.html) # tar zxvf mariadb-5.5.31-linux-x86_64.…
IF条件 declare cursor s is select version from city_server t; s_ city_server.version%type; begin open s; fetch s into s_; if s_>2 then DBMS_OUTPUT.put_line(s_); end if; close s; end; LOOP循环 declare …
1. 修改student表中sdept字段改为varchar类型,长度为30,并且不为空 ) not null 2. 删除student表中的address列 alter table student drop column address 3. 向student表中添加一个列 code 和 address ) not ) not null…