Posts

Showing posts from July, 2021

Microsoft 365 Developer Program

Image
Get a free sandbox, tools, and other resources you need to build solutions for the Microsoft 365 platform. Get a free Microsoft 365 E5 developer subscription​ Be your own administrator and prototype apps and solutions on your sandbox subscription. Includes 25 user licenses for development purposes Access core Microsoft 365 workloads and capabilities (Windows not included), including: All Office 365 apps including SharePoint, OneDrive, Outlook/Exchange, Teams, Planner, Word, Excel, PowerPoint, and more Office 365 Advanced Threat Protection Advanced analytics with Power BI Enterprise Mobility + Security (EMS) for compliance and information protection Azure Active Directory for building advanced identity and access management solutions

Dynamic pivot query in SQL

Image
Dynamic pivot query in SQL SELECT distinct   [ProductName]       , CategoryID       , [UnitPrice]   FROM DynamicPivot   DECLARE @CategoryID NVARCHAR ( MAX ) = '' DECLARE @Query NVARCHAR ( MAX ) = ''   SELECT   @CategoryID +=    QUOTENAME ( CategoryID )+ ',' FROM (        SELECT DISTINCT CategoryID        FROM DynamicPivot ) AS CatId   SET @CategoryID = LEFT( @CategoryID , LEN ( @CategoryID )- 1 )   SET @Query = 'SELECT * FROM   (SELECT        CategoryID,        ProductName,        UnitPrice FROM        DynamicPivot ) AS CatIds PIVOT(        AVG(UnitPrice)        FOR CategoryID IN (' + @CategoryID + ') ) AS ProductPivotTable'   EXECUTE sp_executesql @Query Inserting few new records in table   insert into DynamicPivot   values ( 'Ravioli Angelo' , 9 , 19.50 )   insert into DynamicPivot   values ( 'Chai' , 9 , 19 )   insert