Monday, February 20, 2017

Sql server: Get difference in Day, Hour, Minute and second between two dates

In this article I am going to explain how to find difference between two dates in day, hour, minute and second using sql server.

Implementation:
I want to get difference of two dates in days, hour, minutes and second. To get difference I have use datediff function of sql.

Friday, February 17, 2017

[Solved ]:A network-related or instance-specific error occurred while establishing a connection to SQL Server

How to resolve “a network-related or instance-specific error occurred while establishing a connection to SQL Server” error.

Description:
While I am working on window application I have received the error:


“A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: shared memory provider, error:40 could not open a connection. to sql server)”

Saturday, February 11, 2017

How to concatenate strings in sql server

In this article I am going to explain how to concatenate strings in sql server.

Description:
Earlier we use concatenate strings in Sql server using + symbol. But now sql server introduces the CONCAT function in 2012.

Syntax of + symbol
Select column1+column2 from tablename

Syntax of concat function
Select concat(column1,column2)from tablename

Friday, February 3, 2017

Simple example of Pivot table in SQL Server

In this article I am going to explain how to create Pivot table in SQL Server.


Description:
Pivot query used to show data in tubular format. Means it will convert the multiple rows into multiple columns using aggregate function.