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

In an older post, I described how you could rebuild all the indexes of a database in SQL Server by making use of the undocumented stored procedure “sp_MSforeachtable”. Another common task is when you want to retrieve size information for all the tables in a database. Again, by using “sp_MSforeachtable“, you can easily do that … Read more…

Retrieving Only the Date from a Datetime Value in SQL Server

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 value: 2011-10-10. In SQL Server 2008 or later, you can easily do this by casting/converting the datetime value to the datatype … Read more…

Sequence Objects in SQL Server

SQL Server “Denali” among other introduces Sequence Objects. I am sure that sequence objects are widely known but let’s provide their definition in plain words: A sequence object allows you to set a global counter of values within the scope of a DBMS instance. Whenever you call the sequence object it returns a unique value … Read more…

Using Unicode in SQL Server

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. As I wanted to test this functionality I performed a simple experiment with the Cyrillic alphabet. To … Read more…