Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sql ÅúÁ¿É¾³ýÊý¾Ý¿âÖÐµÄ±í £¨º¬ÓÐÍâ¼üÔ¼Êø£©

 Ð´·¨Ò»£º
set xact_abort on
begin tran
DECLARE @SQL VARCHAR(99)
DECLARE CUR_FK CURSOR LOCAL FOR
SELECT 'alter table '+ OBJECT_NAME(FKEYID) + ' drop constraint ' + OBJECT_NAME(CONSTID) from SYSREFERENCES
--ɾ³ýËùÓÐÍâ¼ü
OPEN CUR_FK
FETCH CUR_FK INTO @SQL
WHILE @@FETCH_STATUS =0
BEGIN
EXEC(@SQL)
FETCH CUR_FK INTO @SQL
END
CLOSE CUR_FK
DEALLOCATE CUR_FK
-- ɾ³ýËùÓбí
DECLARE CUR_TAB CURSOR LOCAL FOR
SELECT 'DROP TABLE '+ NAME from SYSOBJECTS WHERE XTYPE='U' -- AND NAME LIKE 'xx%'
OPEN CUR_TAB
FETCH CUR_TAB INTO @SQL
WHILE @@FETCH_STATUS =0
BEGIN
EXEC(@SQL)
FETCH CUR_TAB INTO @SQL
END
CLOSE CUR_TAB
DEALLOCATE CUR_TAB
commit tran
д·¨¶þ
DECLARE @SQL VARCHAR(99),@TBL VARCHAR(30),@FK VARCHAR(30)
DECLARE CUR_FK CURSOR LOCAL FOR
SELECT OBJECT_NAME(CONSTID),OBJECT_NAME(FKEYID) from SYSREFERENCES
--ɾ³ýËùÓÐÍâ¼ü
OPEN CUR_FK
FETCH CUR_FK INTO @FK,@TBL
WHILE @@FETCH_STATUS =0
BEGIN
SELECT @SQL='ALTER TABLE '+@TBL+' DROP CONSTRAINT '+@FK
EXEC(@SQL)
FETCH CUR_FK INTO @FK,@TBL
END
CLOSE CUR_FK
DECLARE CUR_FKS CURSOR LOCAL FOR
SELECT NAME from SYSOBJECTS WHERE XTYPE='U'
OPEN CUR_FKS
FETCH CUR_FKS INTO @TBL
WHILE @@FETCH_STATUS =0
BEGIN
SELECT @SQL='DROP TABLE ['+@TBL+']'
EXEC(@SQL)
FETCH CUR_FKS INTO @TBL
END
CLOSE CUR_FKS


Ïà¹ØÎĵµ£º

ibatisÖÐÖ±Ö´ÐÐsql£¬·µ»Ø´æ´¢MapµÄListÀàÐÍ

ibatis×÷Ϊһ¸öÇáÁ¿¼¶µÄorm¹¤¾ßÏÖÔڷdz£Á÷ÐУ¬ÎÒÔÚʹÓÃÖз¢ÏÖ£¬ÓÐʱ½ö½öÏ£Íû·µ»ØÒ»¸öÀàÐÍΪmapµÄlist¾Í¿ÉÒÔÁË£¬
±ÈÈç¼òµ¥µÄ²éѯͳ¼ÆÖ®ÀàµÄ£¬Ã»ÓбØÒª¶¨ÒåÌ«¶àµÄpojo£¬Òò´ËÏëÄܲ»ÄÜÔÚibatisÖÐÖ±½Ó´«ÈësqlÓï¾äÀ´Ö´ÐУ¬È»ºó·µ»ØmapÄØ£¿
´ÓÍøÉÏËÑÁËһϣ¬»¹ÕæÓУ¬ÊµÑé³É¹¦ºó×ܽáһϣ¬´ó¼Ò¹²Í¬½ø²½¡£ ÆäʵºÜ¼òµ¥£¬¾Í ......

U9 SQLÓû§×Ô¶¨Ò庯Êý

ÔÚ×ö±¨±íʱoqlÓï¾äÖÐÓÐʱÐèÒªÓõ½Óû§×Ô¶¨Ò庯Êý£¬µ÷ÓÃÖ®ºó±¨±í±¨´í£º¡° ¶ÔÊý¾Ý¼¯¡°DataQuery¡±Ö´Ðвéѯʧ°Ü¡£ 'fn_GetLevelItemCatName' ²»ÊÇ¿ÉÒÔʶ±ðµÄ º¯ÊýÃû³Æ¡£ ')' ¸½½üÓÐÓï·¨´íÎó¡£ ¡° £¬ÓÚÊÇÎÒ½«oqlÓï¾ä½âÎöºóÄÃsqlÓï¾äµ½sql server 2008ÖÐÈ¥Ö´Ðб¨´í£º 'fn_GetLevelItemCatName' ²»ÊÇ¿ÉÒÔʶ±ðµÄº¯ÊýÃû³Æ¡£ ÕâÖÖÎÊÌ ......

²¶»ñSqlÒì³£

°ïÖúÀïµÄ,Óï·¨:
BEGIN TRY
    { sql_statement | statement_block }
END TRY
BEGIN CATCH
          [ { sql_statement | statement_block } ]
END CATCH
[ ; ]
Òì³£²¿·Ö:
ÔÚ CATCH ¿éµÄ×÷ÓÃÓòÄÚ£¬¿ÉÒÔʹÓÃÒÔÏÂϵͳº¯ÊýÀ´»ñÈ¡µ¼Ö CATCH ¿éÖ´ÐеĴíÎóÏûÏ¢£º
ERROR ......

ÈçºÎÇå³ýSQL serverÈÕÖ¾

  Ç°¼¸Ìì×öÒ»¸ö¹ØÓÚÊý¾Ý±íÓÅ»¯µÄ³ÌÐò£¬ÓÉÓÚÊý¾Ý¿âÀïÃæµÄ×ֶεĹØϵ·Ç³£¸´ÔÓ£¬²Ù×÷ÆðÀ´±È½ÏÂé·³£¬¸ÕÓõÄʱºò»¹ºÃ£¬ÔËÐÐʱ¼äÒ»³¤£¬Éú³ÉµÄÊÂÎñÈÕÖ¾ºÜ´ó£¬Õ¼ÓÃÁË10¼¸G£¬´ÅÅ̶¼¿ìÓÃÍêÁË¡£
    µ½ÍøÉÏËÑÁËһϣ¬·½·¨ÏÂÃæÁ½ÖÖ£º
    1.·ÖÀëÊý¾Ý¿â£¬Ö±½Óɾ³ýÊÂÎñÈÕÖ¾Îļþ£¬ÔÙ¸½¼ÓÊý¾Ý¿â£¬ÏµÍ³ ......

SQL Óë ORACLE µÄ±È½Ï (ת)


01¡¢SQLÓëORACLEµÄÄÚ´æ·ÖÅä
ORACLEµÄÄÚ´æ·ÖÅä´ó²¿·ÖÊÇÓÉINIT.ORAÀ´¾ö¶¨µÄ£¬Ò»¸öÊý¾Ý¿âʵÀý¿ÉÒÔÓÐNÖÖ·ÖÅä·½°¸£¬²»Í¬µÄÓ¦Óã¨OLTP¡¢OLAP£©ËüµÄÅäÖÃÊÇÓвàÖصġ£ SQL¸ÅÀ¨ÆðÀ´Ëµ£¬Ö»ÓÐÁ½ÖÖÄÚ´æ·ÖÅ䷽ʽ£º¶¯Ì¬ÄÚ´æ·ÖÅäÓ뾲̬ÄÚ´æ·ÖÅ䣬¶¯Ì¬ÄÚ´æ·ÖÅä³äÐíSQL×Ô¼ºµ÷ÕûÐèÒªµÄÄڴ棬¾²Ì¬ÄÚ´æ·ÖÅäÏÞÖÆÁËSQL¶ÔÄÚ´æµÄʹ Óá£
002¡¢SQ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ