Transaction logs path in SQL 2005

In SQL 2005 ,how can I change the path where the transaction logs are saved.Also is there a way that I can control the size of these logs.So that it doesn't fill up the disk.
Who is Participating?
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
1.Dettach the database by

USE master
exec sp_detach_db 'databasename'

2. copy the log file to desired destination
3.Attach the database, this time mentioning the new location for ldf.

EXEC sp_attach_db @dbname = N'databasename',
   @filename1 = N'<path>\databasedata.mdf',
   @filename2 = N'< new path>\databaselog.ldf'
life_jAuthor Commented:
Is there a way I can do this for the whole of SQL server databases instead of changing for each database.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

life_jAuthor Commented:

I am new to SQL server.

Where do I need to run

USE master
exec sp_detach_db 'databasename'
Aneesh RetnakaranDatabase AdministratorCommented:
in a new Query window
>>I am new to SQL server.
>>USE master
>>exec sp_detach_db 'databasename'

You have to run this command in sql management studio after clicking on new query
You can simply right click on your database in sql mangement sudion all task and then detach.

life_jAuthor Commented:
Is there a way that I can change the transaction logging for all the databases.
imran_fastConnect With a Mentor Commented:
 you have to either detach and then copy the file for each database on different location and then attach it.
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.