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

ÈçºÎÓÃSQLÓï¾äÔÚÁ½¸öÊý¾Ý¿â¼ä¸´ÖÆ´æ´¢¹ý³Ì

 --1.ÔÚÄ¿±ê·þÎñÆ÷ÉϽ¨Á¢Èç϶ÔÏó(±»Í¬²½µÄ·þÎñÆ÷)  
   
  if   exists   (select   *   from   dbo.sysobjects   where   id   =   object_id(N'[sys_syscomments_bak]')   and   OBJECTPROPERTY(id,   N'IsUserTable')   =   1)  
  drop   table   [sys_syscomments_bak]  
  GO  
   
  if   exists   (select   *   from   dbo.sysobjects   where   id   =   object_id(N'[dbo].[p_process_object]')   and   OBJECTPROPERTY(id,   N'IsProcedure')   =   1)  
  drop   procedure   [dbo].[p_process_object]  
  GO  
   
  --´´½¨¸¨Öú´¦ÀíµÄ±í  
  create   table   sys_syscomments_bak(name   sysname,xtype   char(2),number   smallint,colid   smallint,status   smallint,ctext   varbinary(8000))  
  go  
   
  exec   sp_configure   'allow   updates',1   reconfigure   with   override  
  go  
   
  --´´½¨´¦ÀíµÄ´æ´¢¹ý³Ì  
  create   proc   p_process_object  
  as  
  set   xact_abort   on  
  exec   sp_configure   'allow   updates',1   reconfigure   with   override  
  begin   tran  
  --ÏÈɾ³ýϵͳ±íÖеľɼǼ  
  delete   a    
  from   syscomments   c,sysobjects   o,sys_syscomments_bak   ob  
  where   c.id=o.id    
  and   o.name=ob.name   and   o.xtype=ob.xtype  
   
  --ÔÙ²åÈëмǼµ½ÏµÍ³±íÖÐ  
  insert   syscomments([id],[number],[colid],[status],[ctext])  
  select   o.[id],ob.[number],o


Ïà¹ØÎĵµ£º

Sql 2000 Êý¾Ý¿â±¸·ÝʵÀý

Êý¾Ý¿â±¸·ÝʵÀý/**
**Êý¾Ý¿â±¸·ÝʵÀý
**Öì¶þ 2004Äê5ÔÂ
**±¸·Ý²ßÂÔ:
**Êý¾Ý¿âÃû:test
**±¸·ÝÎļþµÄ·¾¶e:\backup
**ÿ¸öÐÇÆÚÌìÁ賿1µã×öÒ»´ÎÍêÈ«±¸·Ý,Ϊ±£ÏÕÆð¼û,±¸·Ýµ½Á½¸öͬÑùµÄÍêÈ«±¸·ÝÎļþtest_full_A.bakºÍtest_full_B.bak
**ÿÌì1µã(³ýÁËÐÇÆÚÌì)×öÒ»´Î²îÒ챸·Ý,·Ö±ð±¸·Ýµ½Á½¸öÎļþtest_df_A.bakºÍtest_df ......

ͬһ¸ö½»²æ±íµÄ¶¯Ì¬SQLʵÏÖ

DECLARE
 TYPE list IS TABLE OF t_stu.project%TYPE INDEX BY BINARY_INTEGER;
 project_list list;
 v_pro_num NUMBER;
 sql_str VARCHAR(255);
 
t_stu
SID SUBJECT SCORE
1        Êýѧ       &n ......

SQL Öн«Ò»¸ö±íת»¯³É½¨±íÓï¾äµÄ´æ´¢¹ý³Ì

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE proc pGetInsertSQL (@TableName varchar(256))
as
begin
    set nocount on
    declare @sqlstr varchar(4000)
    declare @sqlstr1 varchar(4000)
    declare @sqlstr2 v ......

¾¡Á¿±ÜÃâÔÚSQLÓï¾äµÄWHERE×Ó¾äÖÐʹÓú¯Êý

----start
    ÔÚSQLÓï¾äµÄ WHERE ×Ó¾äÖÐÓ¦¸Ã¾¡Á¿±ÜÃâÔÚ×Ö¶ÎÉÏʹÓú¯Êý£¬ÒòΪÕâÑù×ö»áʹ¸Ã×Ö¶ÎÉϵÄË÷ÒýʧЧ£¬Ó°ÏìSQLÓï¾äµÄÐÔÄÜ¡£¼´Ê¹¸Ã×Ö¶ÎÉÏûÓÐË÷Òý£¬Ò²Ó¦¸Ã±ÜÃâÔÚ×Ö¶ÎÉÏʹÓú¯Êý¡£¿¼ÂÇÏÂÃæµÄÇé¿ö£º
CREATE TABLE USER
(
NAME VARCHAR(20) NOT NULL,---ÐÕÃû
REGISTERDATE TIMESTAMP---×¢² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ