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

SQLServer ´æ´¢¹ý³Ì¼ò½éÓëʹÓ÷½·¨

 
      Sql ServerµÄ´æ´¢¹ý³ÌÊÇÒ»¸ö±»ÃüÃûµÄ´æ´¢ÔÚ·þÎñÆ÷ÉϵÄTransacation-SqlÓï¾ä¼¯ºÏ,ÊÇ·â×°Öظ´ÐÔ¹¤×÷µÄÒ»ÖÖ·½·¨,ËüÖ§³ÖÓû§ÉùÃ÷µÄ±äÁ¿¡¢Ìõ¼þÖ´ÐкÍÆäËûÇ¿´óµÄ±à³Ì¹¦ÄÜ¡£
      ´æ´¢¹ý³ÌÏà¶ÔÓÚÆäËûµÄÊý¾Ý¿â·ÃÎÊ·½·¨ÓÐÒÔϵÄÓŵ㣺
            £¨1£©Öظ´Ê¹Óᣴ洢¹ý³Ì¿ÉÒÔÖظ´Ê¹Ó㬴Ӷø¿ÉÒÔ¼õÉÙÊý¾Ý¿â¿ª·¢ÈËÔ±µÄ¹¤×÷Á¿¡£
            £¨2£©Ìá¸ßÐÔÄÜ¡£´æ´¢¹ý³ÌÔÚ´´½¨µÄʱºò¾Í½øÐÐÁ˱àÒ룬½«À´Ê¹ÓõÄʱºò²»ÓÃÔÙÖØбàÒë¡£Ò»°ãµÄSQLÓï¾äÿִÐÐÒ»´Î¾ÍÐèÒª±àÒëÒ»´Î£¬ËùÒÔʹÓô洢¹ý³ÌÌá¸ßÁËЧÂÊ¡£
            £¨3£©¼õÉÙÍøÂçÁ÷Á¿¡£´æ´¢¹ý³ÌλÓÚ·þÎñÆ÷ÉÏ£¬µ÷ÓõÄʱºòÖ»ÐèÒª´«µÝ´æ´¢¹ý³ÌµÄÃû³ÆÒÔ¼°²ÎÊý¾Í¿ÉÒÔÁË£¬Òò´Ë½µµÍÁËÍøÂç´«ÊäµÄÊý¾ÝÁ¿¡£
            £¨4£©°²È«ÐÔ¡£²ÎÊý»¯µÄ´æ´¢¹ý³Ì¿ÉÒÔ·ÀÖ¹SQL×¢ÈëʽµÄ¹¥»÷£¬¶øÇÒ¿ÉÒÔ½«Grant¡¢DenyÒÔ¼°RevokeȨÏÞÓ¦ÓÃÓÚ´æ´¢¹ý³Ì¡£
      ´æ´¢¹ý³ÌÒ»¹²·ÖΪÁËÈýÀࣺÓû§¶¨ÒåµÄ´æ´¢¹ý³Ì¡¢À©Õ¹´æ´¢¹ý³ÌÒÔ¼°ÏµÍ³´æ´¢¹ý³Ì¡£
      ÆäÖУ¬Óû§¶¨ÒåµÄ´æ´¢¹ý³ÌÓÖ·ÖΪTransaction-SQLºÍCLRÁ½ÖÖÀàÐÍ¡£
      Transaction-SQL ´æ´¢¹ý³ÌÊÇÖ¸±£´æµÄTransaction-SQLÓï¾ä¼¯ºÏ£¬¿ÉÒÔ½ÓÊܺͷµ»ØÓû§ÌṩµÄ²ÎÊý¡£
      CLR´æ´¢¹ý³ÌÊÇÖ¸¶Ô.Net Framework¹«¹²ÓïÑÔÔËÐÐʱ(CLR)·½·¨µÄÒýÓ㬿ÉÒÔ½ÓÊܺͷµ»ØÓû§ÌṩµÄ²ÎÊý¡£ËûÃÇÔÚ.Net Framework³ÌÐò¼¯ÖÐÊÇ×÷ΪÀàµÄ¹«¹²¾²Ì¬·½·¨ÊµÏֵġ££¨±¾ÎľͲ»×÷½éÉÜÁË£©
      ´´½¨´æ´¢¹ý³ÌµÄÓï¾äÈçÏ£º
Code
CREATE { PROC | PROCEDURE } [schema_name.] procedure_name [ ; number ] 
    [ { @parameter [ type_schema_name. ] data_type } 
        [ VARYING ] [ = default ] [&n


Ïà¹ØÎĵµ£º

SqlServer´æ´¢¹ý³Ì·ÖÒ³

--TOP n ʵÏÖµÄͨÓ÷ÖÒ³´æ´¢¹ý³Ì(ת×Ô×Þ½¨)
CREATE PROC sp_PageView
@tbname sysname, --Òª·ÖÒ³ÏÔʾµÄ±íÃû
@FieldKey nvarchar(1000), --ÓÃÓÚ¶¨Î»¼Ç¼µÄÖ÷¼ü(Ωһ¼ü)×Ö¶Î,¿ÉÒÔÊǶººÅ·Ö¸ôµÄ¶à¸ö×Ö¶Î
@PageCurrent int=1, --ÒªÏÔʾµÄÒ³Âë
@PageSize int=10, - ......

SQLServer µ¼Èëµ¼³ö

·         ±¾ÎÄÌÖÂÛÁËÈçºÎͨ¹ýTransact-SQLÒÔ¼°ÏµÍ³º¯ÊýOPENDATASOURCEºÍOPENROWSETÔÚͬ¹¹ºÍÒì¹¹Êý¾Ý¿âÖ®¼ä½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬²¢¸ø³öÁËÏêϸµÄÀý×ÓÒÔ¹©²Î¿¼¡£
 
1. ÔÚSQL ServerÊý¾Ý¿âÖ®¼ä½øÐÐÊý¾Ýµ¼Èëµ¼³ö
(1).ʹÓÃSELECT INTOµ¼³öÊý¾Ý 
    ......

sqlserver µÄprepare·½·¨Ê¹ÓÃÎÊÌâ

1.Èç¹ûÏÈprepare ºóÌí¼Ó²ÎÊý£¬ÕâÑùÒ»²¿·ÖÊý¾ÝÀàÐÍ¿ÉÒÔ²»ÓÃÉèÖÃÆäsize´óС£¬ÀýÈçchar
2.Èç¹ûÏÈÌí¼Ó²ÎÊýÔÙprepare£¬¾Í±ØÐëÉèÖòÎÊýµÄÀàÐÍ£¬´óС£¬¾«¶È²ÅÄÜͨ¹ý£¬±ÈÈçchar,varchar,decimalÀàÐÍ£¬¶øint,floatÓй̶¨×Ö½ÚÀàÐ͵ÄÊý¾ÝÀàÐÍÔò¿É²»ÓÃÉèÖôóС¡£
3.¹ØÓÚSqlServerµÄtimestampÀàÐÍ£º¸ÃÀàÐÍΪSqlServerµÄʱ¼ä´ÁÀàÐÍ£¬´´½ ......

sqlserverÁ´½Ó·þÎñÆ÷ʹÓ÷½·¨

EXEC sp_addlinkedsrvlogin @rmtsrvname = 'serverontest', @useself = 'false', @locallogin = 'sa', @rmtuser = 'sa', @rmtpassword = 'passwordofsa'
Ìí¼ÓµÇ¼·½Ê½
ÒÔÉÏÁ½¸öÓï¾äÖУ¬@serverΪ·þÎñÆ÷µÄ±ðÃû£¬@datasrcΪҪÁ´½ÓµÄÄ¿±êÊý¾Ý¿âµÄÁ¬½Ó´®£¬@rmtsrvnameΪ±ðÃû,@localloginΪ±¾µØµÇ¼µÄÓû§Ãû£¬@rmtuserºÍ@rmtpa ......

SQLServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î(ת)

SQL ServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î
2009/02/18 12:29
1. ԭʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹Øϵ
¡¡¡¡¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à¶Ô¶àµÄ¹Øϵ¡£ÔÚÒ»°ãÇé¿öÏ£¬ËüÃÇÊÇÒ»¶ÔÒ»µÄ¹Øϵ£º¼´Ò»ÕÅԭʼµ¥¾Ý¶ÔÓ¦ÇÒÖ»¶ÔÓ¦Ò»¸öʵÌå¡£ÔÚÌØÊâÇé¿öÏ£¬ËüÃÇ¿ÉÄÜÊÇÒ»¶Ô¶à»ò¶à¶ÔÒ»µÄ¹Øϵ£¬¼´Ò»ÕÅԭʼµ¥Ö¤¶ÔÓ¦¶à¸öʵÌ壬»ò¶àÕÅԭʼµ¥Ö¤¶ÔÓ¦Ò»¸öʵÌå¡£ÕâÀïµÄʵÌå¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ