Browse by Tags

All Tags » TSQL (RSS)

SQL Server 2008 - ISDATE doesn't work with

I really don't understand this. The ISDATE function doesn't work with new date and time types, whats more you can't pass it a string representing a date before 1/1/1753. Try this select ISDATE('1/1/1700') in SQL 2008 it will return...
Posted by simonsabin | with no comments
Filed under: ,

SQL Server 2008 - Batch inserts and identity columns using MERGE

Performing bulk inserts into a table when the table has an identity column has long bee a difficult challenge for client programming. The difficulty has been getting the identity values that have been generated for the set of data you are saving. It becomes...
Posted by simonsabin | with no comments

Katmai Spatial - First thoughts

I've been doing some work with the Spatial types in Katmai and these are my first thoughts. The first thing is that the data type is the same used by SQL as used in your .Net code. So what does that mean, · You use the same methods, which is great...

How to get the name of the day of date

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...

What is the position of a row ?

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...
Posted by simonsabin | 1 comment(s)
Filed under: ,

TSQL : How to get messages sent first class

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...
Posted by simonsabin | 1 comment(s)
Filed under: ,

Time dimension - What should the key be?

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...

Using SMO from TSQL

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 There are 2 projects in there one an SSMS project and one a C# project...

Limit a sql script to only run with SQLCMD turned on

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 There is one downside...
Posted by simonsabin | with no comments

How to alert on system errors

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 get round this in...
Posted by simonsabin | with no comments
More Posts « Previous page - Next page »