Grouping Set in SQL Server 2008– Another example

—SQL Server 2008

create table Transport (id int identity(1,1), TransporterId int,

VehicleNo varchar(50), PetrolConsumed int, TotalCost int)

 

insert into Transport values (1,’ABC-123′,15,900)

, (2,’XYZ-654′, 20,1200)

, (1,’MNB-592′,18,1080)

, (2,’XYZ-654′,15,900 )

, (3,’PQR-604′,20,1200)

SELECT TransporterId,Isnull(VehicleNo, ‘Total—–‘)AS VehicleNo

,Sum(PetrolConsumed) AS PetrolConsumed

,Sum(TotalCost) AS TotalCost

FROM Transport

GROUP BY grouping sets( ( TransporterId, VehicleNo, PetrolConsumed, TotalCost ), ( TransporterId ) )

Order By TransporterId

drop table transport


Turn off a Child Portal in DNN (DotNetNuke)

Sometimes you may have a need to turn off a child portal for sometime without using the expiration date host setting.

There is an easy way to do it with IIS’s URLRewrite module.

Here is an example code in web.config file:

<system.webServer>

….

<rewrite>

<rules>

<rule name=”RedirectChildPortal” stopProcessing=”true”>

<match url=”^myChildPortal/$” />

<conditions>

<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />

</conditions>

<action type=”Redirect” url=”SomePage.htm” />

</rule>

</rules>

</rewrite>

</system.webServer>

<system.web>

…..