Posts belonging to Category 'sql server'

SQL Server Versions List

Bill Graziano at SQLTeam.com has a listing of all the SQL Server versions that come in very handy: http://www.sqlteam.com/article/sql-server-versions

Shrink All Log Files Within A MS SQL 2008 Instance

This is an update to a previous post (Shrink All Log Files Within A MS SQL Instance) that has been edited to work in SQL Server 2008. declare @ssql nvarchar(4000) set @ssql= ‘ if ”?” not in (”tempdb”,”master”,”model”,”msdb”) begin use [?] declare @tsql nvarchar(4000) set @tsql = ”” declare @recmodel nvarchar(10) declare @iLogFile int declare [...]

Shrink All Log Files Within A MS SQL Instance

This little SQL script is used to to shrink all the log files in a Microsoft SQL server instance.  It uses the following function to get the job done: DBCC SHRINKFILE. declare @ssql nvarchar(4000) set @ssql= ‘ if ”?” not in (”tempdb”,”master”,”model”,”msdb”) begin use [?] declare @tsql nvarchar(4000) set @tsql = ”” declare @iLogFile int [...]

Shrink SQL Transaction Logs

Here is the t-sql statement used to shrink the SQL transaction logs: Use <DatabaseName> Go Backup Log <DatabaseName> With Truncate_Only DBCC SHRINKFILE(<TransactionLogName>, 1) Go .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } [...]

Backup All SQL Server Databases

I came across this script to backup all SQL Server databases: Code Snippet DECLARE @name VARCHAR(50) — database name DECLARE @path VARCHAR(256) — path for backup files DECLARE @fileName VARCHAR(256) — filename for backup DECLARE @fileDate VARCHAR(20) — used for file name SET @path = ‘E:\Backups\Dynamics’ SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) DECLARE db_cursor CURSOR FOR SELECT [...]

Related Posts with Thumbnails