SQL语句PART7
Merge statement
function benefits: 1) provides the ability to conditionally update, insert or delete data into a database table. 2) performs an update if the row exists, and an insert if it is a new row. --> 1) avoids seperate updates, 2) increase performance and ease of use. 3) is useful in data warehousing applications.
syntax:
MERGE INTO table_name table_alias
USING (table|view|sub_query) alias
ON (join condition)
WHEN MATCHED THEN
UPDATE SET
col1 = col1_val,
col2 = col2_val
WHEN NOT MATCHED THEN
INSERT (column_list)
VALUES (column_values);
e.g.: table: temp_t1:
results:
1 1 收文 SHOUWEN
2 1 发文 FAWEN
3 1 交办 JIAOBAN
4 2 值班报告 REPORT
5 3 督察督办 SUPERVISAL
6 2 值班快报 DAILYREPORT
7 2 我的事情 NOTIFY
8 4 提案 RESOLUTION
9 4 建议 SUGGESTION
e.g.: table: temp_t2:
results:
1 1 收文 SHOUWEN
2 1 发文 FAWEN
3 1 交办 JIAOBAN
4 2 值班报告 REPORT
5 3 督察督办  
相关文档:
SQL Server 2005 日志删除和日志文件限制(转)
2009年08月04日 星期二 下午 04:40
清除日志:
DECLARE @LogicalFileName sysname,
@MaxMinutes INT,
@NewSize INT
USE szwzcheck ......
using System;
using System.Text.RegularExpressions;
using Microsoft.SqlServer.Server;
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction(IsDeterministic = true,IsPrecise = true)]
public static bool RegExIsMatch(string pattern,string matchString)
{
......
基本方法:
UPDATETEXT { table_name.dest_column_name dest_text_ptr }//{ 要更新的表以及 text、ntext 或 image 列的名称,指向要更新的 text、ntext 或 image 数据的文本指针的值(由 TEXT ......
Oracle SQL(partI)
Data manipulation language(DML): select, insert, update, delete, merge.
Data definition language(DDL): create, alter, drop, rename, truncate, comment
Data control language(DCL): grant, revoke
Transaction control: commit, rollback, savepoint
Arithmetic Expressions:
+, -, *, / ......
Differring Constraints:
Constraints can have the following attributes: DEFFERRABLE / NOT DEFFERRABLE, INITIALLY DEFFERRED / INITIALLY IMMEDIATE.
e.g.:
alter table dept2 add constraint dept2_id_pk primary key (department_id) deferrable initially deferred; // deferring constraint on creation. ......