December 2006 Blog Posts
UPDATE: This is now a part of a larger SSMS Add-In called SSMS Tools Pack
I thought I'd post something special as the last post of this year and i was thinking about what it would be.
Fellow SqlTeamer Rockmoose said he'd like to have an add-in for SSMS that would genereate basic
CRUD (Create - Insert, Read - Select, Update, Delete) stored procedures for a table.
And he'd like to have it on the context (right-mouse-click) menu of the table in Object Explorer in SSMS.
It sounded like a very cool little project and with the help of this excellent post about SSMS add-ins
I've decided to...
I was playing with some historical data (family tree) and i wanted to store data in sql server. When looking into family trees you reach the minimum datetime value of 1753-01-01 very soon. But .Net can save dates from 1.1.0001 on. So i went looking into using SQL CLR user defined datatype (UDT).
UDT's are interesting because you have to serialize them.
There are 3 ways of doing that:
- Format.Native
- Format.UserDefined
- Format.Unknown
When Format.Native is used you can only use blittable datatypes. Bol says these are:
bool, byte, sbyte, short, ushort, int, uint, long, ulong, float, double, SqlByte, SqlInt16, SqlInt32, SqlInt64, SqlDateTime,...
I've come across an interesting thing today that i didn't even think could be an issue:
Case senstive object names (tables, columns, triggers, views, etc....).
If your database is created with a Case Sensitive collation then all object names will be Case Sensitive.
I always thought that collations are used for data and not schema but i guess i was wrong.
We had an issue with a view that had a lower case column name in it when it should be uppercase.
A bit of code to prove it:create database testCollation collate Latin1_General_CS_AS -- case sensitive collation
go
use testCollation
create table Test(Col1 int, col2 int)
insert into...
Having started programming in c/c++ i've always been used to casting between types using () operator: int i = (int)x With the coming of .Net framework ValueTypes and ReferenceTypes were introduced and we started hearing about boxing and unboxing. if you're not familiar with these terms pick a link from this search and read up. Also we've been introduced to System.Convert class and IConvertible interface. But old habits are hard to break and i've been preffering the (int) to Convert.ToInt32. For all thing considered i've been treating them as equals. But i've been reminded that they're not with a nice little error...
In a previous post I've shown how to use High precision timer.
That method had a drawback of working for whole server not distiguishing between connections.
So if you ran the time measurement in 2 different windows in SSMS the times would be incorrect.
You'd get the correct time in the window which was run last.
This of course isn't very usefull for proper performace diagnosys.
So with little experimenting i've managed to fix the timer to work properly for each connection.
The code is self explanatory. For each function run I return the spid to which it belongs and i store the HiPerfTimer objects in a...
Lately i've been doing quite an amount of work with Exchange and WebDAV access to it.
Documentation on WebDAV and Exchange server is ok for simple tasks but if you want anything concrete done examples are impossible to come by.
That's why I posted a lengthy article about WebDAV and my experience with it.
Two tools are indespensible when doing any kind of Exchange access development:
Outlook Spy and Exchange Explorer that comes with the Exchange SDK.
But neither of those help in any way with forming correct WebDAV XML requests. OK, they give you the name and namespace of the properites but that's it.
Well PFDavAdmin Tool to...