Refactoring and static code analysis tool for SQL Server
Got a SQL Server or .NET question? Discuss it in the forums. (SQL Server Forums | Dot NET Forums)
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

October 2008 - Posts

SQLXML Lab 3 - Loading information from elements

In the previous example we saw a basic example which explained how to load values from an XML document using XML Bulk Load . The XML had data stored in attributes. In this lab, let us look at a slightly different version of the XML document which stores...
by Jacob Sebastian on 10-19-2008 | 49 Views

How to find the amount of space used by data (.mdf, .ndf) and log (.ldf) files using TSQL

Well, this is a pretty simple question, and many of you out there already know how to do it. SQL Server 2005 introduced a number of system views that gives the size occupied by each data/log file in the database. So it is a matter of just querying one...
by Jacob Sebastian on 10-17-2008 | 80 Views

SQL Server SET Options: Do not depend on the DB level settings

We have examined some of the SET options of SQL Server in the previous posts . We saw how these SET options controls the behavior of SQL Server in different cases. We saw that some of the settings can be done at the database level. When an option is configured...
by Jacob Sebastian on 10-15-2008 | 55 Views

Understanding SQL Server SET Options 4 - SET ARITHABORT ON | OFF

We have examined some of the SET options of SQL Server in the previous posts . These SET options controls SQL Server's behavior to a reasonable extend. In this post, we will examine one more SET option: ARITHABORT. Before we examine ARITHABORT, let...
by Jacob Sebastian on 10-14-2008 | 209 Views

Understanding SQL Server SET Options 3 - SET ANSI_PADDING ON | OFF

Before I say anything about ANSI_PADDING, I would like to show an example. IF OBJECT_ID( 'Customers' ) IS NOT NULL DROP TABLE Customers GO SET ANSI_PADDING OFF ; -- CREATE a table CREATE TABLE Customers( FirstName CHAR (40), LastName VARCHAR...
by Jacob Sebastian on 10-12-2008 | 47 Views

XQuery Lab 38 - Delete elements having date value older than 30 days

  In some of the previous posts , we saw how to delete an element or attribute from an XML document (variable/column). In this post, let us examine one more example that deletes elements from an XML document matching a given criteria. I wrote this...
by Jacob Sebastian on 10-11-2008 | 594 Views

XQuery Lab 37 - Working with multiple namespaces

  We have seen several XQuery examples in the previous posts in this series. We briefly discussed XML namespaces in a couple of posts earlier ( XML Namespaces , SQL Server 2005 XML and Default Namespaces ). Some times, reading values from an XML...
by Jacob Sebastian on 10-11-2008 | 678 Views

Another UNPIVOT Example

We saw an example of UNPIVOT in the previous post . Let us see one more UNPIVOT example in this post.  I wrote this query to help some one in one of the SQL Server forums. Here is the source data: /* SquadID Date Area01 Area02 Area03 Area04 Area05...
by Jacob Sebastian on 10-11-2008 | 514 Views

Using TSQL Function: OBJECT_ID()

The TSQL Function OBJECT_ID() returns the ID of the specific object. SQL Server internally assigns an ID to every object. This function has got a number of usages. I use this function to check for the existence of a table or procedure before dropping...
by Jacob Sebastian on 10-08-2008 | 33 Views

Recursive CTE and Ordering of the hierarchical result

We have seen several examples using recursive CTEs to generate hierarchical result set, in the previous posts. One of the points we discussed briefly but not explored in detail is ordering the results. A recursive CTE can generate a hierarchy/tree but...
by Jacob Sebastian on 10-05-2008 | 146 Views

XML Workshop 22 - A TSQL RSS Library

Part 22 of XML Workshop presents a TSQL RSS Library. It presents a function that accepts an XML parameter and generates a valid RSS 2.0 feed from the information passed in the XML variable. The article also presents a real life example, that generates...
by Jacob Sebastian on 10-05-2008 | 66 Views

TSQL Lab 20 - Performing recursive updates using a BOTTOM to TOP recursive CTE

In the previous post , I mentioned that I am trying to write a query that can be used to replace the WHILE LOOP that we used to update the categories recursively. In this post, I would like to share with you, the query that I wrote to achieve this. Almost...
by Jacob Sebastian on 10-02-2008 | 102 Views

How to find differences between two dates in HH:MM:SS format?

This post demonstrates how to find the differences between two dates in HH:MM:SS format. Some one asked me this question in the MSDN forum this morning. I wrote a query to answer the question. As you all can figure out, there is nothing very complicated...
by Jacob Sebastian on 10-02-2008 | 259 Views

TSQL Lab 18 - Performing Recursive Updates using CTE

In the last few posts, we were discussing recursive updates. We looked at the example of an e-commerce application that lists the hierarchy of categories and sub-categories and displays the number of items under each category, sub-category, sub-sub-category...
by Jacob Sebastian on 10-01-2008 | 186 Views

Copyright © Beyondrelational.com