alkampfer on January 31st, 2012

I’ve a stored procedure with a query that runs on a quite big database, it was slow (more than one minute to run) and was optimized using a temp table. The result is that execution time dropped to ~2 secs, and since this was acceptable the optimization stopped. After a couple of months, the query [...]

kick it on DotNetKicks.com

Continue reading about When it is time to tweak SQL Server queries

alkampfer on January 31st, 2012

In a production Sql Server database we had some issue with the hardware, the result is that one very big database started to gave us errors on DBCC CHECKDB, the error is the following one. Msg 8929, Level 16, State 1, Line 1 Object ID xxxxxx, index ID 1, partition ID xxxxxx, alloc unit ID [...]

kick it on DotNetKicks.com

Continue reading about Hardcore fix error in Sql Server database

alkampfer on December 28th, 2011

Suppose you have a big table with about 3 GB of data in and you need to add a nullable new column on it, you can open SSMS, open the table in designer and create a new column of type Int called sclo_durationInMinutes, press save and the table gets update quite immediately. Then you realize [...]

kick it on DotNetKicks.com

Continue reading about Why Management Studio forces you to know SQL

alkampfer on December 1st, 2011

Another advantage of storing properties of entities into a state object based on a Dictionary, is the ability to easily serialize objects in custom formats. As an example I create an XML serializer that is capable to serialize an entity in a custom XML format. I used this simple serializer to create a NHibernate User [...]

kick it on DotNetKicks.com

Continue reading about Custom XML Serialization

alkampfer on October 28th, 2011

I’have a table with some dirty data, if you select it seems that everything is ok, but since it was imported from an external source, it happens that some string field actually ends with strange non alpha char. The symptom is that I have some strange behavior on some data, then I verify what is [...]

kick it on DotNetKicks.com

Continue reading about Trim all non-alpha character from SQL string