SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Export to Excel, Application Users with Granted Ro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

infodemers
Posting Yak Master

Canada
181 Posts

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

Thanks!

bandi
Flowing Fount of Yak Knowledge

India
2206 Posts

Posted - 03/20/2013 :  01:41:38  Show Profile  Reply with Quote
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/

Edited by - bandi on 03/20/2013 01:46:46
Go to Top of Page

infodemers
Posting Yak Master

Canada
181 Posts

Posted - 03/21/2013 :  11:03:37  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000