If we have a SQL server in place, it is a usual task to clean up the disk because of disk space constraints. I was searching how can I get enough space needed without clearing those error logs. And if you find yourself held in such a scenario, then this post is intended for you.
sp_cycle_errorlog is the solution for this.
EXEC sp_cycle_errorlog ; GO
What this actually does?
Executing this in the database will cycle the error log files without stopping and starting the SQL server. This will close the current error log and cycle the log extensions. Note that this will not technically truncate the log, but roll it over so that you can do a delete or move of these archived logs as you wish.