TSQL (RSS)

TSQL

How to get the name of the day of date

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/How to get the name of the day of date
The new RSS feed is here

Do you have a date and you want the day of the week but not the number but the name i.e. Monday, Tuesday etc. Well there are two functions that you can use with dates that can be used to extract a part of the date. One function returns the number and one returns text version. The functions are DATEPART and DATENAME respectively.

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/How to get the name of the day of date

What is the position of a row ?

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/What is the position of a row ?
The new RSS feed is here

The simple answer is there isn't one.

If you insert 1000 rows into a table and then want to get back the 43rd row you inserted you can't. You can read through all rows and return the 43rd one that the database reads from the table but that is not the same thing.

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/What is the position of a row ?

TSQL : How to get messages sent first class

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/TSQL : How to get messages sent first class
The new RSS feed is here

Leo has posted a great tip about how to get messages output in a TSQL batch without waiting until the batch completes. The trick is to use RAISERROR with a level of 0

http://sqlblogcasts.com/blogs/leopasta/archive/2007/07/03/instant-gratification.aspx

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/TSQL : How to get messages sent first class

Time dimension - What should the key be?

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/Time dimension - What should the key be?
The new RSS feed is here

We are currently implementing a data warehouse and the design of the time dimension was recently being done.

Firstly it was agreed that day and time should be split out. Combining the two into one dimension is nuts your dimension would be huge and unworkable.

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/Time dimension - What should the key be?

Using SMO from TSQL

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/Using SMO from TSQL
The new RSS feed is here

If you are desperate to get your hands on the code I used in the SMO in TSQL demo I did at the usergroup meeting you can download it now from codeplex.

http://www.codeplex.com/SMOinTSQL

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/Using SMO from TSQL

Limit a sql script to only run with SQLCMD turned on

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/Limit a sql script to only run with SQLCMD turned on
The new RSS feed is here

I really like SQLCMDso much so that most of my deployment scripts use SQLCMD. Its got some great features such as

:on error exit. Forcing your script to exit when an error occurs.
or
:r <filename> to read the contents of a file

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/Limit a sql script to only run with SQLCMD turned on

How to alert on system errors

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/How to alert on system errors
The new RSS feed is here

Alerts in SQL server rely on the error being logged to the event log. Not all system messages are logged which means you can't alert on them. In SQL 2000 you could hack the sysmessages table, however in SQL2005 you can't.

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/How to alert on system errors

Developer Day 4 Demo - Now available

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/Developer Day 4 Demo - Now available
The new RSS feed is here

The demo files associated with are now available.

Make sure you read the description first as it includes how to deploy the demo.

http://sqlblogcasts.com/files/folders/servicebrokerdemos/entry1472.aspx

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/Developer Day 4 Demo - Now available

dmvs and CROSS APPLY

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/dmvs and CROSS APPLY
The new RSS feed is here

In SQL 2005 there is a new feature by which you can extend a result set with the results of another resultset. You might think thats nothing new because thats exactly what a join is, and with the combination of derived tables you have full control, and you can use table valued functions.

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/dmvs and CROSS APPLY