|
|
-
|
|
I see developers often confused on how they get the list of objects by IntelliSense when writing the code. Here are some points on how you can intelligently make use of IntelliSense.
When IntelliSense is enabled, in the query window, type SELECT and a s...
|
|
-
|
|
Arithmetic operators are used to perform arithmetic operations like addition, subtraction, multiplication and division. However the operators + ,- and ~ can also be used as unary operators to decide if a number is positive or negative. But we can have f...
|
|
-
|
|
Run the following code
select ' ' ' ' -- Query 1
select '''' -- Query 2
How does the first query return single space whereas the second query returns single single quote?...
|
|
-
|
|
The batch separator in SQL Server signals the end of the batch. By default SQL Server uses GO as the batch separator. However often people get confused on when they should use it compulsorily. Here are the cases where you must use batch separator
1 A...
|
|
-
|
|
I had a requirement to convert table data in XML format. The format is expected to be
. . .
Create this testing table create table testing
(
id int,
first_nam...
|
|
-
|
|
Often, you are advised not to use * in your SELECT statement. It is because the code that depends on * may be broken if a column is added or removed. If you have a view that uses *, it will not reflect newly added/removed column until the view is ...
|
|
-
|
|
Consider the following CREATE TABLE statementscreate table #t1 (i int) -- Statement 1
create table .#t2 (i int) -- Statement 2
create table ..#t3 (i int) -- Statement 3
create table ...#t4(i int) -- Statement 4
How many are incorrect stateme...
|
|
-
|
|
Handling DATETIME values in the queries is often challenging due to various factors which include choosing wrong datatype(VARCHAR instead of DATETIME),formatting in sql,expressing values in regional specific format,removing time part,etc.
Well. Here is...
|
|
-
|
|
I have posted a blog post about Different ways to remove TIME part from DATETIME values where I have shown six different ways to remove TIME part. Some of the regular users posted some alternate methods. Here is the analysis of how long each method take...
|
|
-
|
|
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...
|
|