|
|
-
|
|
You may need to often find the end of the month for various monthly analysis. In this case you need to take all data from 1st of month to end of month.
Consider the following set of data Create table #test(date_col datetime)
insert into #test(date_col)...
|
|
-
|
|
There was a question in the forum on how to Sort mixed value strings “numerically”
Consider the following set of datacreate table #test(val varchar(10))
insert into #test
select '1002' union all
select '29C' union all
select '1' union all
select '205' u...
|
|
-
|
|
Following up Question of the month December 2012 - Why is last comma ignored in CREATE TABLE statement? , here is same question on TABLE VARIABLE
The last comma in permenant and temporary tables are ignored when you run the followingCREATE TABLE emp(emp...
|
|
-
|
|
SEQUENCE is introduced in version 2012. It is an object which can be used to generated customised SEQUENCE numbers that be used across many objects in the database. A SEQUENCE can be directly/indirectly bound with objects.
Consider the following SEQUEN...
|
|
-
|
|
In Query Analyser, set the result mode to Text (Press CTRL+T), execute the following code and see the result. set nocount on
select
space(total-len(replicate(char(characters),no)))+ replicate(char(characters),no*2-1)
from
(
...
|
|
-
|
|
Often I see lot of SQL deveopers complaining about the error when using datetime values in their queries. The common error that almost everyone would heard about is "Conversion failed when converting date and/or time from character string."
But in gener...
|
|
-
|
|
I have started a series on Exploring SSIS where I will explain various features available. In this post, we will see the usage of Execute SQL task in Control flow Execute SQL task is primarily used to execute SQL statements and stored procedures with o...
|
|
-
|
|
Consider the following CREATE TABLE statementsCREATE TABLE emp1(emp_id int,)
GO
CREATE TABLE emp2(emp_id int,first_name varchar(50),)
GONote that there is extra comma after the datatype of last column. But SQL Server ignores it and execute them without ...
|
|
-
|
|
SQL Server Integration Services (SSIS) is one of the tools that can be effectively used to transfer data to various destinations. In versions prior to 2005, we had Import/Export wizard which was part of Database Engine and a package would be created bas...
|
|
-
|
|
I have posted a blog post about Different ways to find DISTINCT values where I have shown six different ways to find DISTINCT values. Here is the analysis of how long each method takes.
Create a temporary table named #sales_detailscreate table #sales_de...
|
|