EDUDOTNET

Wednesday, December 16, 2015

How Design A SQL Query With Dynamic Pivot Columns in SQL Server

DECLARE @cols AS NVARCHAR(MAX);
DECLARE @query AS NVARCHAR(MAX);

select @cols = STUFF((SELECT distinct ',' + QUOTENAME(Id)
                      FROM RWX_Users FOR XML PATH(''), TYPE ).value('.', 'NVARCHAR(MAX)') , 1, 1, '');

SELECT @query =
'SELECT *
FROM
(
  SELECT
    Users.Id
  FROM RWX_Users AS Users
) AS t
PIVOT 
(
  MAX(Id) 
  FOR Id IN( ' + @cols + ' )' +
') AS p ; ';

execute(@query);

Monday, December 14, 2015

Pivot table with single column in sql server

- Create Table

CREATE TABLE MyTable
([Id] int)
;

-Insert Data In to Table

INSERT INTO MyTable
([Id])
VALUES
(1),
(2),
(3),
(4),
(5)
;


-Design a query with Pivot 

select *
from
(
  select  CAST(Id AS VARCHAR(15)) +'Col' AS Name , Id AS UserId
  from MyTable
) d
pivot
(
     Min(UserId)
    FOR [Name] IN ([1Col], [2Col],[3Col],[4Col], [5Col])
) piv;


Sunday, August 23, 2015

AWESOME PRIZE - http://forum.edudotnet.com/

http://forum.edudotnet.com/

Thursday, February 26, 2015

ASP.NET 5 Updates and other improvements for Web Developers in Visual Studio 2015 CTP 6

It's time for another Visual Studio 2015 CTP, and with the CTP 6 release in February 2015 you should find a number of improvements that every web developer will enjoy..... more details


Introducing ASP.NET 5

Introducing ASP.NET 5

ASP.NET 5 is an open source web framework for building modern web applications that can be developed and run on Windows, Linux and the Mac. It includes the MVC 6 framework, which now combines the features of MVC and Web API into a single web programming framework.  ASP.NET 5 will also be the basis for SignalR 3 - enabling you to add real time functionality to cloud connected applications. ASP.NET 5 is built on the .NET Core runtime, but it can also be run on the full .NET Framework for maximum compatibility.


Understanding .NET 2015