SQL Truncate

I need to Truncate SQL database both MDB and LDB. How is this done and what are the risks?
I was told a full SQL backup should be done prior to performing this task.
Is there a way to determine when the last Full backup was done as well?
sullendAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
aheddellConnect With a Mentor Commented:
Do you mean you want to Shrink the file?  If so, you need to use DBCC SHRINKDATABASE or DBCC SHRINKFILE.  Or do it through the Management Studio
0
 
oleggoldCommented:
yes,db log , and yes,full backup required anyways before truncating
0
 
sullendAuthor Commented:
Do I have to detach in order to truncate?
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
aheddellCommented:
No.  Won't work if you detach.

You can in theory truncate the log using the NO_LOG parameter on the BACKUP command.  Its easier to just to do the backup though.  

I assume this is a one off operation?  Is so, the easiest way to determine the last backup is in the SQL Server Management Studio, right-click on the database and select properties.  This data is held in the msdb..backupset table

Cheers

Alex
0
 
sullendAuthor Commented:
Just found out the recovery model is SIMPLE, so BACKUP LOG will no work  At this point I just need a safe way to truncate the log file. Suggestions?  

Please be specific as possible I am not a SQL admin at any level...
0
 
jorge_torizResearch & Development ManagerCommented:
You donĀ“t need to truncate the log file when your database is on SIMPLE recovery model, the file is always truncated
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.