Sunday, May 8, 2016

Difference between temp Table(#Table) and Table variable(@Table) in sql server





Json String in Sql Server

In this post i will show how to display/Convert Table Rows to JSON String.

Continuing the previous Post Create Temp Table in Sql Server

OutPut:

{
                "Data": [{
                                "id": 1,
                                "name": "Kiran",
                                "active": 1
                }, {
                                "id": 2,
                                "name": "Ravi",
                                "active": 1
                }]

}

Create Temp Table in Sql Server or Create Temp Table Variable in Sql Server

In this post I will show how to create Temp Table(variable) using @ symbol.

Previously I had shown

OutPut:

ID
Name
IsActive
1
Kiran
1
2
Ravi
1
3
Vara
1
4
Dinesh
1
5
Deleep
0
6
Phani
1
7
Shiva
1
8
shyam
0