TSQL: Nested Select with multiple results to one (comma separated) string

by Pieter Brinkman 25. August 2009 03:22

For this example I will use the default asp.net Membership tables.

Let say: I need to return all users with their roles (comma separated) in one query. After a long time Googling I found the following solution.

[code:tsql]

select
  UserName,
  (select roles.RoleName + ', '
    FROM aspnet_Roles roles
    join aspnet_UsersInRoles usersInRole on roles.RoleId = usersInRole.RoleId
    WHERE usersInRole.UserId = aspUser.UserId
    for xml path('')) as roles
from
    aspnet_Users aspUser

[/code]

Don't know if this is the best way, but it works.

Tags: , ,

TSQL

Set CultureCode for RDLC (SQL reporting report)

by Pieter Brinkman 11. June 2009 06:34

You can set the culture of a report by clicking the report and setting the Language property. If you want to support multiple cultures you can set the property to =User!Language .

 

Tags: , , ,

ASP.Net

SQLReporting service: Deployment

by Pieter Brinkman 3. March 2009 04:23

When deploying a project to a internal test server I got the following error:

The definition of the report 'Main Report' is invalid.
An unexpected error occurred in Report Processing.
Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
 

Fix this by adding a reference to ProcessingObjecdtModel.dll in you project. You can find the ProcessingObjecdtModel.dll in the GAC. The problem with the GAC is that you can't copy the .dll from the GAC using Windows Explorer. But you can copy the DLL with Command Prompt (cmd.exe).

To do this:

    1. Run -> cmd.exe
    2. cd C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\ 9.0.0.0__b03f5f7f11d50a3a
    3. copy Microsoft.ReportViewer.ProcessingObjectModel.dll c:\locationFolder\
  • This action will look like this:

    Copy the Microsoft.ReportViewer.ProcessingObjectModel.dll to your Bin folder or at a reference to the assembly.

    Hope it helps,

    Pieter

    Tags: , , ,

    ASP.Net

    MsSql: How to enable clr (to run c# / vb code in SQL)

    by Pieter Brinkman 26. June 2008 08:03

    Execute the next query to enable CLR.  

    -- Turn advanced options on

    EXEC sp_configure 'show advanced options' , '1';

    go

    reconfigure;

    go

    EXEC sp_configure 'clr enabled' , '1'

    go

    reconfigure;

    -- Turn advanced options back off

    EXEC sp_configure 'show advanced options' , '0';

    go

    More info about CLR on Microsoft MSDN.

    Tags: , ,

    MSSQL

    Powered by BlogEngine.NET 1.5.0.7
    Theme by Mads Kristensen

    About Me

    My name is Pieter Brinkman I am a .NET Software Engineer for Achmea IT in De Meern, The Netherlands. My interests are mainly web applications created with ASP.NET, MSSQL and Silverlight.

    Calendar

    <<  September 2010  >>
    MoTuWeThFrSaSu
    303112345
    6789101112
    13141516171819
    20212223242526
    27282930123
    45678910

    View posts in large calendar

    RecentComments

    Comment RSS

    Most comments

    club penguin cheats club penguin cheats
    4 comments
    us United States
    Web Design Company Web Design Company
    2 comments
    Web design Web design
    2 comments
    gb United Kingdom