Dynamically Generating T-SQL Statements!

So you have many databases, objects, etc. and you want to massively administer it right? In some of my previous posts I explained the undocumented stored procedures “sp_msforeachdb” and “sp_msforeachtable” that allow you to massively perform changes on all databases and tables within a SQL Server instance. But isn’t it handier to generate dynamic T-SQL … Read more…

Using the OUTPUT Clause: A simple data archiving example

The OUTPUT Clause in T-SQL as described in MSDN SQL Server BOL, “returns information from, or expressions based on, each row affected by an INSERT, UPDATE, DELETE, or MERGE statement.“ The functionality provided by the OUTPUT clause is very powerful and can be used in many scenarios. One such a scenario is Data Archiving. Consider … Read more…

Screencast: Object Dependencies in SQL Server 2008

SQL Server 2008 introduces among other new features and enhancements for accurately tracking Object Dependencies. This is very useful especially in cases where the user wishes to programmatically modify database objects having dependencies and therefore, he/she needs to resolve these dependencies before being able to proceed with the database object modification. For efficiently tracking dependencies … Read more…

Webcast on SQL Server 2008 T-SQL Enhancements Now Publicly Available!

A few days ago I delivered a Live Webcast on Microsoft SQL Server 2008 Programmability and more specifically on T-SQL Enhancements. During the Webcast I talked about the following SQL Server 2008 Programmability features: Variables Declaration and Initialization Compound Assignment Operators Large UDTs DATE, TIME, DATETIME2 New & Enhanced Functions supporting DATETIME2 Precision Table Value … Read more…

New Date-Related Functions in SQL Server 2008

Along with the new data types DATE, TIME and DATETIME2 in SQL Server 2008, new and enhanced functions are also included. These functions are: SYSDATETIME SYSUTCDATETIME SYSDATETIMEOFFSET SWITCHOFFSET TODATETIMEOFFSET A more thorough explanation follows: SYSDATETIME——————This function is like the GETDATE function with the difference that it returns the current date and time with the precision … Read more…