DB2ÁÙʱ±íÔÚSQL¹ý³Ì
°æȨÉùÃ÷£ºÔ´´×÷Æ·£¬ÈçÐèתÔØ£¬ÇëÓë×÷ÕßÁªÏµ¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£
DB2ÁÙʱ±íÔÚSQL¹ý³ÌºÍSQLÓï¾äÖеIJâÊÔ×ܽá
²âÊÔÄ¿±ê£º
·Ö±ðÔÚSQL¹ý³ÌºÍSQLÓï¾äÖд´½¨ÁÙʱ±í£¬²¢²åÈëÊý¾Ý£¬¿´Ö´Ðнá¹ûÓÐʲôÒìͬ¡£
²âÊÔ»·¾³£º
DB2 UDB V9.1
Ö´Ðи½¼þÀïÃæµÄSQLÓï¾ä£¬µÃµ½Ò»¸ö±í¡£
²âÊÔ´úÂëºÍÔËÐнá¹û£º
Ò»¡¢ÁÙʱ±íÔÚSQLÓï¾äÖÐ
-- ¶¨ÒåÒ»¸öÈ«¾ÖÁÙʱ±íSESSION.RESULT
DECLARE GLOBAL TEMPORARY TABLE SESSION.RESULT
(
TMP_HYDM VARCHAR(10), -- ÐÐÒµ´úÂë
TMP_HYMC VARCHAR(300) -- ÐÐÒµÃû³Æ
)
WITH REPLACE
NOT LOGGED;
-- ²åÈëÊý¾Ýµ½ÁÙʱ±í
INSERT INTO SESSION.RESULT
SELECT MLDM,MLMC from DM_HY_CY;
-- ²éѯÁÙʱ±íÊý¾Ý
SELECT * from SESSION.RESULT;
²âÊÔ½á¹û£ºÒÔÉÏSQL´úÂëÕý³£Ö´ÐУ¬µ«ÊÇûÓвéѯµ½ÈκÎÊý¾Ý¡£
¶þ¡¢ÁÙʱ±íÔÚSQL´æ´¢¹ý³ÌÖÐ
CREATE PROCEDURE SP_TEST_TMEP ( )
DYNAMIC RESULT SETS 1
------------------------------------------------------------------------
-- ÓïÑÔ£ºDB2 SQL ´æ´¢¹ý³Ì
-- ˵Ã÷£ºÓÃÀ´²âÊÔͨ¹ý²éѯ²åÈëÁÙʱ±íÊý¾Ý
-- ×÷ÕߣºÈÛ ÑÒ
-- ÈÕÆÚ£º2008-08-31
------------------------------------------------------------------------
P1: BEGIN
-- ¶¨ÒåÒ»¸öÈ«¾ÖÁÙʱ±íSESSION.RESULT
DECLARE GLOBAL TEMPORARY TABLE SESSION.RESULT
(
TMP_HYDM VARCHAR(10), -- ÐÐÒµ´úÂë
&n
Ïà¹ØÎĵµ£º
CREATE DATABASE
´´½¨Ò»¸öÐÂÊý¾Ý¿â¼°´æ´¢¸ÃÊý¾Ý¿âµÄÎļþ£¬»ò´ÓÏÈÇ°´´½¨µÄÊý¾Ý¿âµÄÎļþÖи½¼ÓÊý¾Ý¿â¡£
˵Ã÷ ÓйØÓë DISK INIT Ïòºó¼æÈÝÐԵĸü¶àÐÅÏ¢£¬Çë²Î¼û"Microsoft® SQL Server™ Ïòºó¼æÈÝÐÔÏêϸÐÅÏ¢"ÖеÄÉ豸£¨¼¶±ð 3£©¡£
Óï·¨
CREATE DATABASE database_name
[ ON
[ < filespec > ......
¸Õ¸ÕÔÚinthirtiesÀÏ´óµÄ²©¿ÍÀï¿´µ½ÕâƪÎÄÕ£¬Ð´µÄ²»´í£¬ÕýºÃ×Ô¼º×î½üÔÚѧϰPL/SQL£¬×ª¹ýÀ´Ñ§Ï°Ñ§Ï°¡£
==================================================================================
bulk collectÊÇ¿ÉÒÔ¿´×öÊÇÒ»ÖÖÅú»ñÈ¡µÄ·½Ê½£¬ÔÚÎÒÃǵÄplsqlµÄ´úÂë¶ÎÀï¾³£×÷ΪintoµÄÀ©Õ¹À´Ê¹Ó᣶ÔÓÚselect id into v from ... ......
SQL ÃüÁî
Õⲿ·Ö°üº¬ÄÇЩ PostgreSQL Ö§³ÖµÄ SQL ÃüÁîµÄÐÅÏ¢£®ÕâÀïµÄ "SQL" ¾ÍÊǸÃÓïÑÔͨ³£µÄº¬Ò壻 ÿÌõÃüÁîµÄÓë±ê×¼ÓйصļæÈÝÐÔµÄÐÅÏ¢¿ÉÒÔÔÚÏà¹ØµÄ²Î¿¼Ò³ÖÐÕÒµ½£®
Table of Contents
ABORT -- Í˳öµ±Ç°ÊÂÎñ
ALTER GROUP -- Ïò×éÖÐÔö¼ÓÓû§»ò´Ó×éÖÐɾ³ýÓû§
ALTER USER -- ¸Ä±äÊý¾ ......
»ùÓÚSQL Server ·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø ÊÕ²Ø
Õë¶ÔÊý¾Ý¿âÊý¾ÝÔÚUI½çÃæÉϵķÖÒ³ÊÇÀÏÉú³£Ì¸µÄÎÊÌâÁË£¬ÍøÉϺÜÈÝÒ×ÕÒµ½¸÷Ö֓ͨÓô洢¹ý³Ì”´úÂ룬¶øÇÒÓÐЩ»¹¶¨ÖƲéѯÌõ¼þ£¬¿´ÉÏȥʹÓúܷ½±ã¡£±ÊÕß´òËãͨ¹ý±¾ÎÄÒ²À´¼òµ¥Ì¸Ò»Ï»ùÓÚSQL SERVER 2000µÄ·ÖÒ³´æ´¢¹ý³Ì£¬Í¬Ê±Ì¸Ì¸SQL SERVER 2005Ï·ÖÒ³´æ´¢¹ý³ÌµÄÑ ......
--»ùÓÚʱ¼äSQLº¯Êý--
getdate() --·µ»Øµ±Ç°ÏµÍ³ÈÕÆÚºÍʱ¼ä¡£
DateAdd --ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ¡£
DATEADD ( datepart , number, date )
--Àý£ºÏòµ±ÌìµÄʱ¼äÔö¼Ó5Ìì
select dateadd(dd,5,getdate())
datediff --·µ»Ø¿çÁ½¸öÖ¸¶¨ÈÕÆÚµÄÈÕÆÚºÍʱ¼ä±ß½çÊý¡£]
---ÀýÈç
& ......