SQL֮ʮ profiler
Microsoft SQL Server Profiler ÊÇ SQL ¸ú×ÙµÄͼÐÎÓû§½çÃ棬ÓÃÓÚ¼àÊÓ Êý¾Ý¿âÒýÇæ»ò Analysis Services µÄʵÀý¡£Äú¿ÉÒÔ²¶»ñÓйØÿ¸öʼþµÄÊý¾Ý²¢½«Æä±£´æµ½Îļþ»ò±íÖй©ÒÔºó·ÖÎö¡£ÀýÈ磬¿ÉÒÔ¶ÔÉú²ú»·¾³½øÐмàÊÓ£¬Á˽âÄÄЩ´æ´¢¹ý³ÌÓÉÓÚÖ´ÐÐËÙ¶ÈÌ«ÂýÓ°ÏìÁËÐÔÄÜ¡£
¿ÉÒÔʹÓà SQL Server ProfilerÀ´´´½¨Ä£°å£¬¶¨ÒåÒª°üº¬ÔÚ¸ú×ÙÖеÄʼþÀàºÍÊý¾ÝÁС£¶¨Òå²¢±£´æÄ£°åºó£¬¿ÉÒÔÔËÐиú×ÙÀ´¼Ç¼ÿ¸öÑ¡¶¨Ê¼þÀàµÄÊý¾Ý¡£Äú¿ÉÒÔ½«Ò»¸öÄ£°åÓÃÓÚ¶à¸ö¸ú×Ù£»Ä£°å±¾Éí²¢²»»áÖ´ÐС£
SQL Server Profiler¿ÉÏÔʾ SQL Server ÈçºÎÔÚÄÚ²¿½âÎö²éѯ¡£Õâ¾Íʹ¹ÜÀíÔ±Äܹ»×¼È·²é¿´Ìá½»µ½·þÎñÆ÷µÄ Transact-SQL Óï¾ä»ò¶àά±í´ïʽ£¬ÒÔ¼°·þÎñÆ÷ÊÇÈçºÎ·ÃÎÊÊý¾Ý¿â»ò¶àάÊý¾Ý¼¯ÒÔ·µ»Ø½á¹û¼¯µÄ¡£
Ïà¹ØÎĵµ£º
–1¡¢²éÕÒÔ±¹¤µÄ±àºÅ¡¢ÐÕÃû¡¢²¿ÃźͳöÉúÈÕÆÚ£¬Èç¹û³öÉúÈÕÆÚΪ¿ÕÖµ£¬ÏÔʾÈÕÆÚ²»Ïê,²¢°´²¿ÃÅÅÅÐòÊä³ö,ÈÕÆÚ¸ñʽΪyyyy-mm-dd¡£
select emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),’ÈÕÆÚ²»Ïê’) birthday
from employee
order by dept
–2¡¢²éÕÒÓëÓ÷×ÔÇ¿ÔÚͬһ¸öµ¥Î»µÄÔ±¹¤ÐÕÃû¡¢ ......
ADO.net£¬Linq to SQLºÍEntity FrameworkÐÔÄÜʵ²â·ÖÎö
¡¡¡¡×î½üÎĵµÐ´Á˲»ÉÙ£¬µ¼ÖÂWordºÍExcelµÄʹÓÃÄÜÁ¦·ÉÒ»°ã³É³¤¡£¿¼Âǵ½ÏîÄ¿ÖжÁдÊý¾Ý¿âµÄ·½·¨´æÔÚЧÂʲ»¸ß£¬ÒÔÖÂÓ°ÏìÓû§ÌåÑéµÄÎÊÌ⣬¾ö¶¨²âÊÔÒ»ÏÂMicrosoftÐÂÍÆÐеÄLinqºÍEFÄܲ»ÄÜÔÚЧÂÊÉÏÓÐËù¸Ä½ø¡£
¡¡¡¡²âÊÔ»·¾³µ±È»¾ÍÊÇÎÒÕą̂±Ê¼Ç±¾ÁË£¬ÊÜÏÞÓëÓ²ÅÌתËÙ£¬ÔËÐÐÆð ......
SQLÖÐobject_idº¯ÊýµÄÓ÷¨ ÊÕ²Ø
int object_id('objectname');
´Ë·½·¨·µ»ØÊý¾Ý¿â¶ÔÏó±êʶºÅ¡£
ÆäÖУ¬²ÎÊýobjectname ±íʾҪʹÓõĶÔÏó£¬ÆäÊý¾ÝÀàÐÍΪnchar»òchar£¨Èç¹ûΪchar£¬ÏµÍ³½«Æäת»»Îªnchar£©
·µ»ØÀàÐÍΪint£¬±íʾ¸Ã¶ÔÏóÔÚϵͳÖеıàºÅ¡£
±ÈÈ磺
use wf_timesheet
select object_id('usp_check_excess ......
ÔÚƽʱµÄ¹¤×÷¹ý³ÌÖУ¬×÷ΪDBA½ÇÉ«¹ÜÀíÊý¾Ý¿â£¬Í·ÄÔÖеÄÓ¡ÏóÍùÍùÊÇÊý¾Ý¿âʵÀýÃû³Æ£¬¶ø²»»áÈ¥¹ØÐÄServerµÄIP£¬¶ø×÷ΪDeveloperµÄ½ÇÉ«£¬ËûÃÇÍùÍùÏëÖªµÀÖªµÀServer IpºÍ¶Ë¿ÚºÅ¡£ËùÒÔ£¬DBA»á¾³£±»Îʼ°µ½£ºXXXʵÀýµÄIPºÍ¶Ë¿ÚºÅÊÇʲô£¿
Õâ¸öÎÊÌ⣬µ±È»ÎÒÃÇ¿ÉÒÔLoginµ½OS²é¿´IP¡¢Ê¹ÓÃÅäÖƹÜÀí¹¤¾ß»ñÈ¡µ½¶Ë¿ÚºÅ¡£µ«ÊÇ£¬Õâ¸ö·½·¨·Ç ......
ʹÓÃTranact-SQL ±àд´úÂëÀ´´´½¨Ò»¸öÐÂ±í£º
USE [OnlineJudge]
GO
/****** Object: Table [dbo].[User1] Script Date: 05/17/2010 14:05:06 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[User2](/*notice convert the tablename*/
[num] [int]IDENTITY(1,1) NOT N ......