MSSQL Some TSQL you may interested to Know – 一些有趣/有用的TSQL 指令

今天在朋友的網誌上學會了更多檢查 Microsoft SQL Server狀況的TSQL Code
感到十分有用..
希望大家喜歡

用來找出這台SQL Server 上已經安裝了多小棵CPU

SELECT  COUNT(*) AS No_Of_Processor
FROM    sys.dm_os_schedulers
WHERE   status = 'VISIBLE ONLINE'

用來找出SQL Server在什麼時候開始運作

SELECT
    crdate AS Start_Date_Time_Of_SQL_Server
FROM
     master.dbo.sysdatabases
WHERE
    name = 'tempdb'

用來建立新的SQL Log 檔案

EXEC sp_cycle_errorlog

Hope you find it useful

 

Leave a Reply