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

SQLÖÐobject_idº¯ÊýµÄÓ÷¨

 int object_id('objectname');
´Ë·½·¨·µ»ØÊý¾Ý¿â¶ÔÏó±êʶºÅ¡£
ÆäÖУ¬²ÎÊýobjectname ±íʾҪʹÓõĶÔÏó£¬ÆäÊý¾ÝÀàÐÍΪnchar»òchar£¨Èç¹ûΪchar£¬ÏµÍ³½«Æäת»»Îªnchar£©
·µ»ØÀàÐÍΪint£¬±íʾ¸Ã¶ÔÏóÔÚϵͳÖеıàºÅ¡£
±ÈÈ磺
use wf_timesheet
select object_id('usp_check_excess_hours')
·µ»ØΪ197575742¡£
´Ë·½·¨Ò»°ãÓÃÀ´ÅжÏÊý¾Ý¿âÖб¾À´ÓÃûÓд˶ÔÏó£¨procedures£¬views£¬functionsµÈ£©£¬ÈçÔÚн¨Ò»¸ö´æ´¢¹ý³ÌʱÎÒÃÇ¿ÉÒÔ¿´µ½ÕâÑùµÄÓï¾ä£º
IF NOT EXISTS (SELECT * from sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_send_email]') AND type in (N'P', N'PC'))
ÊÂÏÈÅжÏÊý¾Ý¿âÖÐÊÇ·ñÒѾ­´æÔÚ´æ´¢¹ý³Ìusp_send_email£¬


Ïà¹ØÎĵµ£º

sql server2000ÖÐÔõô¶Ô´æ´¢¹ý³Ì½øÐмÓÃܺͽâÃÜ

 1. >>¼ÓÃÜ
from the Books Online:
Use the WITH ENCRYPTION option:
IF EXISTS (SELECT name from sysobjects
WHERE name = 'encrypt_this' AND type = 'P')
DROP PROCEDURE encrypt_this
GO
USE pubs
GO
CREATE PROCEDURE encrypt_this
WITH ENCRYPTION
AS
SELECT *
from authors
GO
EXEC sp ......

SQL ÖÐGROUP BY ×ܽá

GROUP BY ×Ó¾äÓÃÀ´¶ÔÖ¸¶¨µÄ×Ö¶Î×ö·Ö×飬²úÉúÒ»¸ö»ã×ÜÐÅÏ¢¡£ £¨1£©group byÓï¾ä¶ÔselectºóËùÑ¡ÔñµÄ×Ö¶ÎÓÐÒ»¶¨µÄÏÞÖÆ£¬¼´selectºóûÓÐʹÓþۺϺ¯ÊýµÄ×ֶαØÐë°üº¬ÔÚgroup by Óï¾äºóÃæµÄ½á¹û¼¯ÖС££¨GROUP BY ¹Ø¼ü×Öºó¸úÒ»¸öÁеÄÁÐ±í£¬³ÆΪ×éºÏÁУ©. £¨2£©²»ÄܶÔÊý¾ÝÀàÐÍΪ ntext¡¢text¡¢image »ò bit µÄÁÐʹÓà GROUP BY »ò ......

SQL LIKE ͨÅä·û

LIKEºÍͨÅä·û
©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥
È·¶¨¸ø¶¨µÄ×Ö·û´®ÊÇ·ñÓëÖ¸¶¨µÄģʽƥÅ䡣ģʽ¿ÉÒÔ°üº¬³£¹æ×Ö·ûºÍͨÅä·û×Ö·û¡£Ä£Ê½Æ¥Åä¹ý³ÌÖУ¬³£¹æ×Ö·û±ØÐëÓë×Ö·û´®ÖÐÖ¸¶¨µÄ×Ö·ûÍêÈ«Æ¥Å䡣Ȼ¶ø£¬¿ÉʹÓÃ×Ö·û´®µÄÈÎÒâƬ¶ÎÆ¥ÅäͨÅä·û¡£ÓëʹÓÃ
= ºÍ != ×Ö·û´®±È½ÏÔËËã·ûÏà±È£¬Ê¹ÓÃͨÅä·û¿Éʹ LIKE ÔËË ......

SQL UnionÓ÷¨×ܽá

UNION ÔËËã·û½«¶à¸ö SELECT Óï¾äµÄ½á¹û×éºÏ³ÉÒ»¸ö½á¹û¼¯¡£ £¨£±£©Ê¹Óà UNION ÐëÂú×ãÒÔÏÂÌõ¼þ£º £Á£ºËùÓвéѯÖбØÐë¾ßÓÐÏàͬµÄ½á¹¹£¨¼´²éѯÖеĵÄÁÐÊýºÍÁеÄ˳Ðò±ØÐëÏàͬ£©¡£ £Â£º¶ÔÓ¦ÁеÄÊý¾ÝÀàÐÍ¿ÉÒÔ²»Í¬µ«ÊDZØÐë¼æÈÝ£¨ËùνµÄ¼æÈÝÊÇÖ¸Á½ÖÖÀàÐÍÖ®¼ä¿ÉÒÔ½øÐÐÒþʽת»»£¬²»ÄܽøÐÐÒþʽת»»Ôò±¨´í£©¡£Ò²¿ÉÒÔÓÃÏÔʽת»»ÎªÏàͬµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ