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 ......
SQLÓï¾äÓï·¨
Ŀ¼
13.1. Êý¾Ý¶¨ÒåÓï¾ä
13.1.1. ALTER DATABASEÓï·¨
13.1.2. ALTER TABLEÓï·¨
13.1.3. CREATE DATABASEÓï·¨
13.1.4. CREATE INDEXÓï·¨
13.1.5. CREATE TABLEÓï·¨
13.1.6. DROP DATABASEÓï·¨
13.1.7. DROP INDEXÓï·¨
13.1.8. DROP TABLEÓï·¨
13.1.9. RENAME TABLEÓï·¨
13.2. Êý¾Ý²Ù×÷Óï¾ ......
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:
+, -, *, / ......