SQL Server????????????????
???????????? ???????[ 2017/2/14 11:34:50 ] ????????????? SQL Server
?????????
????1??SQL Server???????????????
????????????????????????????о?SQL Server ???????????????飬???????Щ?????????????????о?SQL Server ???????????????к????????о????????????SQL Server??????????bug?????????service pack???????????????????????????????·?????????SQL Server ???????????????????????????DEFAULT????????????ò??????????????message_enqueue_time???????UTC????@@Pack_Received?????????????д????????????????????????????
????2?????????????DEFAULT????????????ò???
????DEFAULT????????????DDL????ж???DEFAULT???????????????????????????????á???DEFAULT?????????????????????????????NULL?????????Ч????
??????SQL Server????????????????У???????????????????????????????????NULL??DEFAULTЧ????????????T-SQL????
SELECT *
FROM [sys].[dm_db_index_physical_stats](NULL?? NULL?? NULL?? NULL?? NULL);
GO
SELECT *
FROM [sys].[dm_db_index_physical_stats](DEFAULT?? DEFAULT?? DEFAULT?? DEFAULT?? DEFAULT);
GO
???????????T-SQL???????????????
???????????????????????Щ????????????????NULL??DEFAULTЧ?????????????fn_trace_getinfo??fn_trace_gettable?????????T-SQL????
DECLARE @nvcDefaultTraceFilePath AS NVARCHAR(4000);
SET @nvcDefaultTraceFilePath = N'';
SELECT @nvcDefaultTraceFilePath = [path]
FROM [sys].[traces]
WHERE [id] = 1;
SELECT *
FROM ::fn_trace_gettable(@nvcDefaultTraceFilePath?? NULL);
SELECT *
FROM ::fn_trace_gettable(@nvcDefaultTraceFilePath?? DEFAULT);
GO
???????????T-SQL???????????????
?????????????????????У?????????????????????NULL??DEFAULT??Ч???????????????fn_virtualfilestats???????T-SQL????
SELECT *
FROM ::fn_virtualfilestats(1?? NULL);
SELECT *
FROM ::fn_virtualfilestats(1?? DEFAULT);
???????????T-SQL???????????????
????3???????????message_enqueue_time???????UTC???????
?????????о?service broker???????????????????????message_enqueue_time???UTC???????
?????????????tempdb??????????????????????Ч????????T-SQL????
USE [tempdb];
GO
-- ????????
IF OBJECT_ID(N'[dbo].[NotifyQueue]'?? 'SQ') IS NULL
BEGIN
CREATE QUEUE [dbo].[NotifyQueue]
WITH
STATUS = ON
??RETENTION = OFF
END
GO
-- ????????
IF NOT EXISTS (SELECT 1 FROM [sys].[services] WHERE [name] = N'EventNotifyService')
BEGIN
CREATE SERVICE [EventNotifyService]
ON QUEUE [dbo].[NotifyQueue] ([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification]);
END
GO
-- ????·??
IF NOT EXISTS (SELECT 1 FROM [sys].[routes] WHERE [name] = N'NotifyRoute')
BEGIN
CREATE ROUTE [NotifyRoute]
WITH
SERVICE_NAME = N'EventNotifyService'
??ADDRESS = N'LOCAL';
END
GO
-- ?????????
IF NOT EXISTS (SELECT 1 FROM [sys].[event_notifications] WHERE [name] = N'CreateTableNotification')
BEGIN
CREATE EVENT NOTIFICATION [CreateTableNotification]
ON DATABASE
FOR CREATE_TABLE
TO SERVICE 'EventNotifyService'?? 'current database';
END
GO
??????????? T-SQL??????£?
IF OBJECT_ID(N'[dbo].[TableCreate]'?? 'U') IS NULL
BEGIN
CREATE TABLE [dbo].TableCreate
(
Col1 INT
??Col2 VARCHAR(100)
??Col3 XML
)
ON [PRIMARY]
END
GO
????????????????????л???б??T-SQL???????£?
SELECT
CAST([message_body] AS XML)
??message_enqueue_time
??*
FROM [dbo].NotifyQueue
GO
???????????T-SQL????????????
??????????????????????ο??????????????????????????????????????е??????message_enqueue_time???????UTC??????????????????????????
???????
?????????????T-SQL????????????SQL Server 2012 ????????????2?棩?е?12??12.4.4?????С???е?????嵥 12-3 CreateQueue.sql??
????4??@@Pack_Received??????????д???
?????????????SQL Server???????????????????@@Pack_Received??@@Packet_Errors????????????????????????????????????????????????????????
????5???????
????????????????????????SQL Server ??????????????????о???????????????? ???о?????????????з?????????SQL Server?????????3???????????????????DEFAULT????????????????????????NULL??????DEFAULT??????????????????message_enqueue_time??α???UTC????????????????????о?????sql server?????????????????????UTC??????????????????????????????л??
??????ú????и??2???????????????????????д????????????????????д?????????????????????????????????????????????????λ?????????????????μ???????????????????????????????ɡ?
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11