How does SQL Server Management Studio move columns?

SSMS (SQL Server Management Studio) does not use any kind of wizardry as one might think. It creates a new table, moves the data, drops the original table and renames the new table to the original name.

The design tool in SSMS can generate a script for any changes you have made.
This option is available via "Generate Change Script" in the "Table Designer" menu or via right-clicking the table editor.

View log usage in SQL2005 using Dynamic Management objects

SQL Server 2005 introduces a number of Dynamic Management objects. One of these is dm_os_performance_counters which gives you access to SQL Server Performance Counters that were only available through Performance Monitor. Several of the counters are related to the log so we can see the log usage for databases from within SQL Server.

Variable column widths, string lengths in printf-style functions


I have been programming in C for quite some time, but until recently I was not aware that you could specify column widths and string limits using variables. I have neither seen this functionality used in any projects until I started working with OpenSER.

Specify a variable column width:

printf("%*d", width, number);

Specify a variable number of characters from a string:

printf("%.*s", width, string);

Proper UDF - Capitalize String as Proper Names

The ufn_Proper() UDF for SQL Server is similar to the VFP Proper() function. It additionally allows to specify a set of delimiters.


IF EXISTS (SELECT * FROM sysobjects WHERE name = N'ufn_Proper')

Strextract UDF - Retrieves String Between Two Delimiters

The ufn_StrExtract() UDF for SQL Server is similar to the VFP StrExtract() function.

Alines UDF - String Split

The ufn_Alines() UDF for SQL Server is similar to the VFP Alines() function but w/o additional parameters.


Subscribe to The Bereznikers RSS