|
|
-
|
|
We discussed FOR XML in a number of previous posts. SQL Server 2005 added a few enhancements to the FOR XML clause. One of the enhancements added in SQL Server 2005 is the PATH clause which helps to do a great deal of customization/control over the structure XML result being generated. Another keywo......
|
|
-
|
|
DATALENGTH() returns the number of bytes used to store a value. Let us see an example to understand this.
DECLARE @i INTDECLARE @d DATETIMESELECT DATALENGTH(@i) AS LengthOf_i, DATALENGTH(@d) AS LengthOf_d /*LengthOf_i LengthOf_d----------- -----------NULL NULL*/
<!--
.csharpc......
|
|
-
|
|
So, what is there to understand in this simple function? It just returns the length of a string. Most of us are using this function to find the length of variables and value stored in columns. There is nothing so complicated about this function. True.
Well, this function does exactly the same when ......
|
|
-
|
|
When I started learning SQL Server several years back (and I admit this learning attempt is still in progress) , one of the mistakes I did a few times was something like the following:
IF OBJECT_ID('Customers') IS NOT NULL DROP TABLE CustomersGOCREATE TABLE Customers( CustomerName VARCHAR(20), ......
|
|
-
|
|
In the previous few posts, we were discussing the different grouping and aggregation functions of SQL Server. Grouping and aggregation is a large subject and the focus of the posts in this series is on the part that generates total rows in the query result.
We have so far examined COMPUTE BY, WI......
|
|
-
|
|
In the last few posts, we discussed different grouping/aggregation methods using ROLLUP, CUBE and COMPUTE BY. We saw the difference between ROLLUP and CUBE. SQL Server 2008 added some enhancements to ROLLUP and CUBE.
In addition, SQL Server 2008 added a new grouping related function GROUPING_ID()......
|
|
-
|
|
In the previous posts, we have seen two examples that add additional rows with summarized values to the result of a query. The first post demonstrated a basic example without going deep into the aggregation functions. However, the second example demonstrated a little more complex example using WITH ......
|
|
-
|
|
In the previous post we saw a simple example that adds a total line to the end of the query. In this post, let us see a little more advanced example of a query that adds sub totals and grand totals to the result of a query using WITH ROLLUP.
For example, assume that you need to write a query that ......
|
|
-
|
|
This question is not very relevant today as it was in the past years. Today, most of the data presentations requests are handled by reporting applications and they are capable of calculating the totals of a column. However, there may be times when we might need to retrieve the total of one or more c......
|
|
-
|
|
SQL Server 2000 supports 4 transaction Isolation levels. We have examined them in the previous posts. The 4 transaction isolation levels supported by SQL Server 2000 is given below:
READ COMMITTED
READ UNCOMMITTED
REPEATABLE READ
SERIALIZABLE
Each of these isolation levels offers different ......
|
|