SQL server´¥·¢Æ÷ÈëÃÅ1 ´´½¨Ò»¸ö¼òµ¥µÄ´¥·¢Æ÷
´¥·¢Æ÷ÊÇÒ»ÖÖÌØÊâµÄ´æ´¢¹ý³Ì£¬ÀàËÆÓÚʼþº¯Êý£¬SQL Server™ ÔÊÐíΪ Insert¡¢Update¡¢Delete ´´½¨´¥·¢Æ÷£¬¼´µ±ÔÚ±íÖвåÈë¡¢¸üС¢É¾³ý¼Ç¼ʱ£¬´¥·¢Ò»¸ö»òһϵÁÐ T-SQLÓï¾ä¡£
´¥·¢Æ÷¿ÉÒÔÔÚ²éѯ·ÖÎöÆ÷Àï´´½¨£¬Ò²¿ÉÒÔÔÚ±íÃûÉϵãÓÒ¼ü->“ËùÓÐÈÎÎñ”->“¹ÜÀí´¥·¢Æ÷”À´´´½¨£¬²»¹ý¶¼ÊÇҪд T-SQL Óï¾äµÄ£¬Ö»ÊÇÔÚ²éѯ·ÖÎöÆ÷ÀïÒªÏÈÈ·¶¨µ±Ç°²Ù×÷µÄÊý¾Ý¿â¡£
´´½¨´¥·¢Æ÷Óà Create TRIGGER
Create TRIGGER ´¥·¢Æ÷Ãû³Æ
ON ±íÃû
FOR Insert¡¢Update »ò Delete
AS
T-SQL Óï¾ä
×¢Ò⣺´¥·¢Æ÷Ãû³ÆÊDz»¼ÓÒýºÅµÄ¡£
ÈçÏÂÊÇÁª»ú´ÔÊéÉϵÄÒ»¸öʾÀý£¬µ±ÔÚ titles ±íÉϸü¸Ä¼Ç¼ʱ£¬·¢ËÍÓʼþ֪ͨ MaryM¡£
Create TRIGGER reminder
ON titles
FOR Insert, Update, Delete
AS
EXEC master..xp_sendmail 'MaryM',
'Don''t forget to print a report for the distributors.'
Ïà¹ØÎĵµ£º
ÔÚ¸ø¸÷ºÏ×÷ѧУ°²×°Ó¦ÓÃϵͳ¹ý³ÌÖУ¬·¢ÏÖѧУÀïµÄSQL SERVER 2000Êý¾Ý¿âËð»µÁËÖØ×°ºó¶¼·¢ÉúÁËͬÑùµÄÎÊÌ⣬ÄǾÍÊÇ°²×°SQL SERVERÊý¾Ý¿â²»³É¹¦¡£ÔÒò£º¼´Ê¹Äãͨ¹ý¿ØÖÆÃæ°åÀïµÄ“Ìí¼Ó/ɾ³ý³ÌÐò” Õý³£µÄжÔØSQL SERVERÊý¾Ý¿â£¬µ«ÊÇ£¬SQL SERVER»¹ÊÇûÓÐÍêȫжÔظɾ»£¬»¹ÐèÒªÊÖ¹¤½øÐÐһЩ²Ù×÷¡£Òò´ËÖØа²×°²»³É¹¦£¬º ......
A¡£
SQLÓï¾äµÄ²¢¼¯UNION£¬½»¼¯JOIN(ÄÚÁ¬½Ó£¬ÍâÁ¬½Ó)£¬½»²æÁ¬½Ó(CROSS
JOINµÑ¿¨¶û»ý)£¬²î¼¯(NOT IN)
1.
a. ²¢¼¯UNION
SELECT column1, column2 from table1
UNION
SELECT column1, column2 from table2
b. ½»¼¯JOIN
SELECT * from table1 AS a JOIN table2 b ON a.name=b.name
c. ²î¼¯NOT IN
SELECT * from tabl ......
sql serverÊý¾Ý¿â±¸·Ý·½°¸
2008-08-05 13:15
SQL Server Êý¾Ý¿â±¸·Ý·½°¸
ΪÁ˱£Ö¤SQL Server Êý¾ÝµÄ°²È«£¬Êý¾Ý¿â¹ÜÀíÔ±Ó¦¶¨ÆÚ±¸·ÝÊý¾Ý¿â£¬ÔÚ²»Í¬Çé¿öÏÂÓ¦²ÉÓò»Í¬±¸·ÝÊý¾Ý¿â±¸·Ý²ßÂÔ£¬Ò»·½Ãæά³ÖÊý¾ÝµÄ°²È«ÐÔ£¬ÁíÒ»·½ÃæÒ²¿É±£³ÖSQL Server ÄÜ˳³©ÔËÐС£¾¡×î´óµÄŬÁ¦¼õÉÙÓÉÓÚÊý¾ÝµÄË𻵶Կͻ§Ôì³ÉµÄËðʧ¡£
¸ÅÄî
1) ±¸·Ý ......
ÉϽÚÎÒÃǽéÉÜÁ˱íÁ¬½Ó£¬¸üÈ·ÇеÄ˵ÊÇinner joins內Á¬½Ó£®
¡¡¡¡內Á¬½Ó½öÑ¡³öÁ½ÕűíÖл¥ÏàÆ¥ÅäµÄ¼Ç¼£®Òò´Ë£¬Õâ»áµ¼ÖÂÓÐʱÎÒÃÇÐèÒªµÄ¼Ç¼ûÓаüº¬½øÀ´¡£
¡¡¡¡Îª¸üºÃµÄÀí½âÕâ¸ö¸ÅÄÎÒÃǽéÉÜÁ½¸ö±í×÷ÑÝʾ¡£ËÕ¸ñÀ¼Òé»áÖеÄÕþµ³±í(party)ºÍÒéÔ±±í(msp)¡£
party(Code,Name,Leader)
Code: Õþµ³´úÂë
Name: Õþµ³ ......
import java.io.*;
import java.sql.*;
public class DBConn {
private String ADDRESS ;
private int PORT ;
private String DBNAME ;
private String USERNAME ;
private String PASSWORD ;
private Connection conn ;
private PreparedStatement pstmt ;
pri ......