|
|
-
|
|
My friend told me that in an interview he was asked to write a code that sums the digits of the number. He asked me if there is a way of doing it without using a WHILE loop. Here are two methods
Method 1 : Dynamic SQLdeclare @i int, @sql varchar(8000)
s...
|
|
-
|
|
Does creating a primary key always create a clustered index? Can a clustered index be created using a column other than the primary key? SQL Server has not such relation/rule between primary keys and clustered indexes....
|
|
-
|
|
When you write queries that involve datetime columns, it is often needed to remove time part from datetime value to compare only date part. An example would be, you have table called sales_details that has sales_date as one of the columns and you want t...
|
|
-
|
|
Ok. Here is some Fun. This is the script that will produce zero without using any number in the code. Post your code if you find any such method
select
$,
$+,
$+.,
-$,
$*$,
+$-,
($),
$.,
($.),
-+$-,
+-$+.,
-$+.+$.,
'$,'-$+,
'$,.'-$-.
Run the code and see the output.......
|
|
-
|
|
Recently a friend of mine asked for a script, for documentation purpose which can help them to create all of their indexes list with column names used in each index. I thought, I must share this simple script with my blog readers. ...
|
|
-
|
|
One of the features available in SQL Server 2005 is Row_Number() function. It is not only used to generate row number for each row but also used for other purposes as well. I breifly explain how it can be used for various purposes
Consider the following data
Declare @t table(item varchar(100), p......
|
|
-
|
|
How to install Sql Server Management Studio???Why I can’t install Sql Server Management Studio???Unable to install Sql Server Management Studio??? SQL Server Management Studio is a tool included with Microsoft SQL Server 2005 and later versions for co...
|
|
-
|
|
NULL. This is a magical word in Database programming. Here are some interesting facts about NULL in SQL Server.
1 NULL can be defined as absense of value, undefined, or the value which is unknown at this point of time.2 All datatypes can be defined with...
|
|
-
|
|
Today, we will talk about a slightly different, yet very common subject. We will talk about what are the different ways to measure the number of rows in a table. I found a couple of posts over the Internet, and I will reference them as and when I demonstrate the associated methods. This post basica......
|
|
-
|
|
The PIVOT operator available in SQL Server 2005 is used to generate the Cross-tab results
Consider this example
select * from
(
select Year(OrderDate) as pivot_col,e.lastname, o.OrderDate FROM northwind..Employees as e
INNER JOIN northwind..Orders as o ON (e.EmployeeID=o.EmployeeI......
|
|