Mladen Prajdić Blog

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

Become a Better Developer in 6 months. How?

Yes, me too. :) I was tagged with this by Denis who has liven (is that even a word?) up to his nick "The SQL Meance". Bad Dennins, bad! As lame as this thing might be and it does reminds us of the dreaded chain letters (anyone remeber getting those by normal mail. Read more →

Centralized Asynchronous Auditing with Service Broker

My article about Service Broker fundamentals and simple practical use has been posted on SQLTeam.com. Go check it out. Service Broker is a new feature in SQL Server 2005. It is an integrated part of the database engine and it provides queuing and reliable direct asynchronous messaging between SQL Server 2005 instances only. Read more →

SQL Server 2005: Easily importing XML Files

In SQL Server 2005 importing XML files became very easy. OPENROWSET now supports the BULK keyword which lets us import XML files with ease. A little example:  CREATE TABLE XmlImportTest ( xmlFileName VARCHAR(300), xml_data xml ) GO DECLARE @xmlFileName VARCHAR(300) SELECT @xmlFileName = 'c:\TestXml. Read more →

C# 2.0: Arity - ever heard of it?

Arity is the number of arguments that a method takes. For example void MyMethod(int i1, int i2)  has an arity of 2, since it takes 2 arguments. In C# the arity is marked with ` Read more →

SQL Server 2005: Concat values XML Style

A few days ago i showed how to split string with XML. Now it's time for concatenation with XML.  DECLARE @t TABLE (col VARCHAR(10)) INSERT into @t select 'aaaa' UNION ALL select 'bbbb' UNION ALL select 'cccc' UNION ALL select null UNION ALL select 'dddd' Read more →

Weird C# compile possibility

Now this is something i really didn't think it would compile in C#.  private int _someVar = 0; private void DoStuff1() { int _someVar = 0; _someVar = 6; // . Read more →

SQL Server 2005: Split string XML Style

Here's a Split function using XML datatype. It's preety neat and simple compared to all others that i've seen. Forget While Loops and recursive CTE's. Enter XML:  IF OBJECT_ID('dbo.Split') IS NOT NULL DROP FUNCTION dbo. Read more →

SQL Server 2005: How to have a Unique Constraint with multiple NULLS on a column

Ever wanted to have have a table that contains unique values but needs to have multiple null values also? Here's how to do it: SET NUMERIC_ROUNDABORT OFF; SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON; GO CREATE TABLE t1 (id INT, title VARCHAR(20)) GO – optional instead of trigger to disable the insert directly into the table CREATE TRIGGER trg_t1_DisableInsert ON t1 INSTEAD OF INSERT AS BEGIN – use 18 to stop further processing RAISERROR (40000, 18, 1, 'Use view dbo. Read more →