How to retrieve size information for all the tables in a SQL Server Database

In an older post, we have discussed about, how you could rebuild all the indexes of a database in SQL Server by making use of the undocumented stored procedure “sp_MSforeachtable”.   Retrieving Table Size Info using sp_MSforeachtable Another common task is when you want to retrieve size information for all the tables in a database. … Read more…

Useful T-SQL Knowledge for SQL Developers and DBAs

In this article, I present useful T-SQL knowledge for SQL Developers and DBAs. A few days ago I started writing an article that it would provide a set of useful tips on SQL Server topics that are met in the everyday life of DBA/Database Developer. The article is now completed and you can find it … Read more…

Retrieving Only the Date from a Datetime Value in SQL Server

This article discusses about retrieving only the date from a datetime value in SQL Server.   Why Converting Datetime to Date? There are many times where you might need to only retrieve the date from a datetime value. For example, you may have today’s datetime (2011-10-10 20:30:28.230) and you want to only get the following … Read more…

Updating SQL Server Tables Without Causing Blocking

Even though the SQL Server Database Engine automatically sets the best possible locking hints on the underlying database objects of the various T-SQL operations that executes, there are cases where we need to manually control locking as a part of the business logic in our T-SQL script.   About the NOLOCK Table Hint A popular locking … Read more…

Executing Heavy Set-Based Operations Against VLDBs in SQL Server

In this article, we will discuss about executing heavy set-based operations against Very Large Datatabases (VLDBs) in SQL Server.   Introduction Recently I had to design and execute some heavy set-based T-SQL operations against a large number of very large databases (VLDBs) within a SQL Server instance. I won’t enter the debate of Row-Based vs. … Read more…

Using Unicode in SQL Server

In this article, we will be discussing about using Unicode in SQL Server.   Introduction Unicode is the standard used in the computing industry for encoding and representing any text in the most written languages (…). SQL Server supports Unicode, thus allowing the easy storage and manipulation of data in the most languages.   Example … Read more…

Dynamically Generating T-SQL Statements in SQL Server

This article discusses about dynamically generating T-SQL statements for SQL Server database administration and development purposes.   Why 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 … Read more…

Segmenting Strings in SQL Server

Lately I have been dealing a lot with SQL Server development that involves among other, segmenting strings. So, I decided to post an example-based article that discusses some simple ways of segmenting strings with T-SQL mainly by using the SUBSTRING built-in function and some other built-in functions such as CHARINDEX, LEFT, RIGHT and LEN. Additionally, … Read more…

Eliminating Blank Spaces in SQL Server Tables

In this article, we will be discussing about eliminating blank spaces in SQL Server table records and columns.   About Blank Spaces Blank spaces always needed special handling in many programming languages. This is not an exception in the case of the SQL programming language. In SQL Server, a variety of built-in string functions exist … Read more…

Using PowerPivot’s Copy-Paste Support for Importing Data from Word

In this article, we will be discussing about using PowerPivot’s copy-paste support for importing data from MS Word.   Importing Data into PowerPivot One of the great features of SQL Server PowerPivot is that it supports importing data directly from the clipboard. This is quite handy in cases you want to import and analyze data … Read more…

Using the OUTPUT Clause: A simple data archiving example

In this article, we will be discussing about the OUTPUT clause in SQL Server, and how we can use it for creating data archiving mechanisms.   What is the OUTPUT Clause in SQL Server? The OUTPUT Clause in T-SQL as described in the relevant MS Docs article, “returns information from, or expressions based on, each … Read more…

Introduction to SQL Server PowerPivot – MS Momentum 2009 Session Review

This article, is an introduction to SQL Server PowerPivot and also a review of my session on the MS Momentum 2009 event, that took place in Cyprus.   About the MS Momentum 2009 Event in Cyprus On November 26th 2009, Microsoft-Cyprus launched Momentum 2009; a New Efficiency Community Launch event. The event took place in Nicosia, … Read more…