跳到主要內容

發表文章

目前顯示的是有「SQL」標籤的文章

MS SQL資料庫Log檔過大,處理方法

先確認資料庫的邏輯名稱 Select * from sys.database_files 後續以Northwind為例說明: SET NOCOUNT ON     DECLARE @LogicalFileName sysname,            @MaxMinutes INT ,            @NewSize INT     -- *** MAKE SURE TO CHANGE THE NEXT 4 LINES WITH YOUR CRITERIA. ***     USE     Northwind               -- This is the name of the database                                   -- for which the log will be shrunk.     SELECT   @LogicalFileName = 'Northwind_Log' ,   -- Use sp_helpfile to       -- identify the logical file       -- name that you want to shrink.            @MaxMinutes = 10 ,       -- Limit on time allowed to wrap log.            @NewSize    =...

SQL command用來抓取資料庫時間

SQL command用來抓取資料庫時間 例如:100/03/10 08:59:39 --> 1000310085939 Select Right('000'+ cast( datepart(yy,getdate()) -1911 as nVarChar),3) + Right( '00' + cast( datepart(mm,getdate()) as nVarChar) ,2) +Right( '00' + cast( datepart(dd,getdate()) as nVarChar) ,2)+Right( '00' + cast( datepart(hour,getdate()) as nVarChar) ,2) + Right( '00' + cast( datepart(minute,getdate()) as nVarChar) ,2)+ Right( '00' + cast( datepart(second,getdate()) as nVarChar) ,2)