Groups | Blog | Home
all groups > sql server msde > august 2004 >

sql server msde : Truncate log not working ?


jlpraz NO[at]SPAM corobori.com
8/25/2004 8:52:05 PM
I am using SQL.DMO with MSDE, I am trying to shrink and truncate the
log, the code works, no error message but the log seems to there and
didn't change its size

oSQLServer.Databases.Item(dbName).TransactionLog.Truncate()
oSQLServer.Databases.Item(dbName).Shrink(10,
SQLDMO_SHRINK_TYPE.SQLDMOShrink_Default)

Is this correct ?

Jean-Luc
Jacco Schalkwijk
8/26/2004 12:15:50 PM
You need to do a log backup with truncate before you try to shrink the file.
In T-SQL it is
BACKUP LOG <database name> WITH TRUNCATE_ONLY. I think in SQL-DMO you can
use the Backup object to achieve the same.

--
Jacco Schalkwijk
SQL Server MVP


[quoted text, click to view]

AddThis Social Bookmark Button