Mladen Prajdić Blog

Blog about stuff and things and stuff. Mostly about SQL server and .Net

Sorter - a kind of ISortable implementation

I often wondered why is there no ISortable interface of somekind in .Net. I recently needed to sort items in the context menu in alphabetical order. Sorting them was the begining of a journey which produced this class. Read more →

SQL Server 2005 Output Clause

I ran into this little gem today while doing some deletes and forgeting Delete syntax :))) There is now Output clause for DELETE, INSERT and UPDATE statements. It outputs the affected rows into a table variable, a simple resultset or into a table. Read more →

Column values Concat the SQL Server 2005 way

Here's an interesting way of contencating values in one column. It makes use of the new XML capabilities. use master select column_name as col1 FROM INFORMATION_SCHEMA.Columns WHERE table_name = 'spt_values' select (select column_name as col1 FROM INFORMATION_SCHEMA. Read more →

Manual Update statistics on small tables may provide a big impact

This is an interesting thing to know. It seems that automatic update of statistics doesn't work for small tables (up to 500 rows) on SQL server 2000. More here.  Legacy Comments Tara 2006-05-12 re: Manual Update statistics on small tables may provide a big impact Posting the same comment from the forums: You aren't supposed to rely on the auto update statistics anyway. Read more →

spSPrintF - an alternative to xp_sprintf

in xp_sprintf up to 50 arguments can be specified. sometimes there's a need for more. This is it and it could as easily be rewritten as a function. create proc spSPrintF @body varchar(8000) = '', @params varchar(1000) = '', @paramSeparator varchar(10) = ',' as begin if @params = '' begin select @body return end -- so we don't have to specially handle the last item set @params = @params + @paramSeparator declare @param varchar(200) while @params <> '' begin select @param = replace(left(@params, charindex('"' + @paramSeparator, @params)), '"', ''), @body = stuff(@body, charindex('%s', @body), 2, @param), @params = replace(@params, '"' + @param + '"' + @paramSeparator, '') end select @body end go declare @body varchar(8000), @params varchar(1000) select @body = 'This is a %s text i have to %s with some %s i want', – Parameters must be in format '"parameterValue","parameterValue2","parameterValue3"' – no spaces between parameters! Read more →

Great DataSet visualizer

Visual studio's DataSet visualizer is ok but it's not that great :)) This one is excellent and if you do a lot of db development (which you do if you're reading blogs on SQLTeam :)) you need this. Read more →

Blittable - now that's a word!

As i saw this word being used with blittable and non-blittable datatype i couldn't help but laugh… who comes up with this stuff?? Blittable types are datatypes that don't require conversion when passed between managed and unmanaged code while non-blittable datatypes are represented differently in managed and unmanaged code. Read more →

WebDAV

I've posted an article about WebDAV protocol and my use of it for accessing MS Exchange store. WebDAV is based on HTTP 1.1 and is based on sending XML requests to find, set, remove and search for item properties. Read more →

WebDAV How, What and Problems…

What is WebDAV? WebDAV stands for "Web-based Distributed Authoring and Versioning". It's a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers. Read more →

Converting TSQL/C#/VB Code to HTML

you paste the code you want to display on the page and it creates the color coded html. preety cool… http://www.manoli.net/csharpformat/ there's even a source of the app that does the convert that you can view. Read more →