Category Archives: Data

Shrink all SQL Server logfiles

After backing up the log files on a SQL server, the logs are truncated and you might want to reclaim the disk space held by those empty log files. This little Transact-SQL script will do just that. DBCC SQLPERF(logspace) GO DECLARE @logsize AS INT = 256; — MB DECLARE @databasename AS VARCHAR(256); DECLARE @filename VARCHAR(256); [...]

Fast (dynamic) DataTable load

When you stuff data in a DataTable you need to first build the columns with, then add the rows containing all of the field values. To map properties from strongly typed objects to DataTables involves either tedious error prone mapping code or a more versatile and CPU hungry way using Reflection. The small code snippet [...]

Serializing table data for SOAP posts in T-SQL

In an integration setup where a SQL Server trigger uses a CLR method with a generic WS client to publish changes to table data, you need to transform the ‘inserted’ table data to a serialized XML. In this example the CLR method simply wraps the xml content in the common SOAP envelope, and uses HttpWebRequest [...]

Follow

Get every new post delivered to your Inbox.