SQL Script to get user account data from DotNetNuke…

Login as Host, go to Host > SQL and paste the following script.  Once it runs (I’ve only tested this on DNN 07.04.02 (216))  you’ll see a green success notification on the page and the table of user data will appear below. I suggest copying and pasting into your favorite spreadsheet program, because clicking the icon to Save Query prompts you to name your query, and then save it and you’d think you’d get a prompt to download a usable file, csvs are always easy, but it doesn’t download, so you’d think that it might save a copy of the query results to the server, maybe in the root. I even looked in there, and searched Admin and Host File Managers… the icon just saves the query so you can run it again later in the loader. lol.

Here is the SQL script… just go Host > SQL, then paste and run. Hope it works for you 🙂

DECLARE @PortalID int;
DECLARE @authorized bit;
SET @PortalID = 0
SET @authorized = 1
SELECT U.UserID
, U.Username
, U.FirstName
, U.LastName
, U.Email
, U.DisplayName
, UP.CreatedDate
, UP.Authorised AS Authorzied
FROM USERS AS U
LEFT JOIN UserPortals AS UP
ON (U.UserId = UP.UserId)
WHERE ( UP.PortalId = @PortalId OR @PortalId IS NULL )
AND Authorised = COALESCE(@authorized, Authorised)
ORDER BY U.FirstName + ‘ ‘ + U.LastName