Shrink transactionlogs

To shrink the MS-SQL transactionlogs for emergency storage needs we can use the following syntax. USE MYDB; GO — Truncate the log by changing the database recovery model to SIMPLE. ALTER DATABASE MYDB SET RECOVERY SIMPLE; GO — Shrink the truncated log file to 1 MB. DBCC SHRINKFILE (MYDB_Log, 1); GO — Reset the database […]

Tablecopy with T-SQL

Today i found myself in a situation where i needed to copy some data from one table on a MS-SQL server to another. I found the following T-SQL syntax to be very helpfull. UPDATE DST SET DST.Title = SRC.Title, DST.ContractNumber = SRC.ContractNumber, DST.ContractDescription = SRC.ContractDescription FROM Contracts AS DST INNER JOIN [SERVERNAME].[DBNAME].DBO.Contracts AS SRC ON […]