Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Export to Excel, Application Users with Granted Ro

Author  Topic 

infodemers
Posting Yak Master

183 Posts

Posted - 2013-03-19 : 12:45:46
Is there an easy way to export to Excel, the list of all Application Users and roles from the database aspnetdb?

Thanks!

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-20 : 01:41:38
There are several methods:
1)Use Import/Export Wizard
http://www.66pacific.com/sql_server_export_to_excel.aspx
2)use OPENROWSET
http://blog.sqlauthority.com/2008/01/08/sql-server-2005-export-data-from-sql-server-2005-to-microsoft-excel-datasheet/
Go to Top of Page

infodemers
Posting Yak Master

183 Posts

Posted - 2013-03-21 : 11:03:37
Hi,

I was not clear about my needs. My issue is not to export to excel. It is about getting the list. I finally managed it with the following code.

use [aspnetdb]
SELECT vw_aspnet_Roles.RoleName,vw_aspnet_Users.UserName,vw_aspnet_Users.LastActivityDate
FROM vw_aspnet_Users INNER JOIN
aspnet_Applications ON vw_aspnet_Users.ApplicationId = aspnet_Applications.ApplicationId INNER JOIN
vw_aspnet_UsersInRoles ON vw_aspnet_Users.UserId = vw_aspnet_UsersInRoles.UserId INNER JOIN
vw_aspnet_Roles ON vw_aspnet_UsersInRoles.RoleId = vw_aspnet_Roles.RoleId
WHERE (vw_aspnet_Users.UserName LIKE '%@%')
ORDER BY vw_aspnet_Users.UserName, aspnet_Applications.ApplicationName,vw_aspnet_Roles.RoleName
Go to Top of Page
   

- Advertisement -