How do I get a list of the reports available on any given reporting server? - sql

I'm wanting to be able to input any given report server url and display a list of reports available on that server.
I found this question, and it's useful if I compile the project with a reference to a specific sql server (How do I get a list of the reports available on a reporting services instance). But (unless I'm just completely missing something which is possible) it doesn't show me how to do what I've stated above.

You could query the ReportServer database of your reporting server.
SELECT *
FROM dbo.Catalog
WHERE Type = 2
Should give you a list of all of the reports.

You can go to Web Service URL (note: not Report Manager URL). So if your main managing URL is http://server/Reports and Web Service URL is http://server/ReportServer - open the second one. It will give you raw listing of available items.
Note that this will include reports, datasources, folders etc.

Same as answer above,
with a use clause added at top
(in case this helps anyone ..) :
Use ReportServer;
SELECT *
FROM dbo.Catalog
WHERE Type = 2
Order by Name
I noted that select * above contains a field called Content which might be an issue for an export of result to excel .. So I tried a lesser list of columns :
Use ReportServer;
SELECT
ItemID,
Path,
Name,
ParentID,
Type,
Description,
Hidden,
CreatedByID,
CreationDate,
ModifiedByID,
ModifiedDate,
Parameter
FROM dbo.Catalog
WHERE Type = 2
Order by Name
The first answer above didn't seem to work for me ..
i.e. http://server/ReportServer
(replacing server with my reporting server name ..)
I get message "The webpage cannot be found" ..
Maybe this answer is version or security settings specific ?

Related

Maximo: Mimic Workflow assignments with an SQL query

I want to write an SQL query that mimics the results in the Maximo Start Center assignments section. The assignments are workflow assignments.
I tried querying the workorder table and specifying the assignedownergroup that the user is in:
select
*
from
workorder
where
status in ('WAPPR','APPR','INPRG')
and assignedownergroup = 'FIRE'
However, the query returns more work orders than what's shown in the Start Center assignments.
How can I write a query to mimic the workflow assignments in the Start Center?
My other answer would work if the portlet you highlighted was a Result Set against WORKORDER, but it is not. The portlet you have highlighted is the Workflow Inbox, which is based on WFASSIGNMENT where assigncode = 'userid'.
A full query that mimics the workflow inbox would look like this, in Oracle SQL:
select
(select 'WO '||wonum||' ('||description||') is waiting for '||wfassignment.description
from workorder
where workorderid = wfassignment.ownerid
and wfassignment.ownertable = 'WORKORDER'
/* Union in other tables */) description,
app
from wfassignment
where assignstatus = 'ACTIVE'
and assigncode = 'JDOE'
I'm not sure where the WO prefix on the assignment description comes from. But since you could add workflow to your own app based on your own object, I would like to think it comes from metadata somewhere instead of code. And the description itself is probably a format string in MAXMESSAGES.
You'll notice the Union in comment in my query, where you would add unioned queries against PR or PM or ASSET or whatever.
The easiest way to get the SQL Maximo is running is:
Go to the Logging application
Select the sql Root Logger and add a "child" Logger of WORKORDER.WORKORDER (that's SERVICE.OBJECT from DB Config) with a Log Level of INFO.
Get ready to open your log file.
Load your start center.
Open your log file.
The SQL issued by Maximo to load the result set should be near the bottom of your log file.

SQL select by field acting weird

I am writing this post because I have encountered something truly weird with an SQL statement I am trying to make.
Context:
I am developing an app which uses JPA in the backend to persist / retrieve objects to/from a postgres database.
Problem:
During some tests I have noticed that when a particular user adds entries in the database and later I try to fetch them by his facebook id, the result is an empty list, even though the entries are there in the database. Doing a select statement on the database returns no rows. This does not happen with other users.
I have noticed that the mentioned user's facebook id is slightly longer then others. I do not know if and how this affects this situation.
Interesting part:
When during debugging I created an entry not programmatically, but manually with a SQL INSERT statement directly on the database (marked red on the 1st screenshot), I could fetch the data by facebook id both in my app and with a select statement.
Do you have any ideas what is going on here?
Please check the screenshots:
result of select * from table:
result of select * from table where user_facebook_id = 10215905779020408 :
Please help,
Thanks

How to get list of current/active TFS users?

I can use TFSCONFIG IDENTITIES to see all users in TFS, however, that pulls up accounts that are years old and no longer have an AD account tied to it. I want to limit search to only people that have an AD account. Is this possible? I did find blog below, but before I try that I wanted to see if there was a powershell script or TFS command that would provide what I needed. thanks.
https://blogs.msdn.microsoft.com/tfssetup/2013/09/18/how-to-generate-a-report-of-active-users-who-log-onto-the-tfs-server/
There is no such TFS command line could handle this situation. Afraid you have to go through the collection database level in TFS to obtain related info.
You could use Last_Access_Time, a sample script as below:
SELECT IdentityName,
StartTime,
Command,
IPAddress,
ExecutionTime
FROM tbl_Command WHERE CommandId IN
(SELECT Max(CommandId) FROM tbl_Command WHERE Application NOT LIKE 'Team Foundation JobAgent' Group By IdentityName ) ORDER BY Last_Access_Time DESC
Note, before you run the SQL script, you could double check if there are something changed, if there are some columns not available any more, since the blog is out of date.
Another way is archiving the contents of the tbl_command in the TFS databases. In the TFS databases tbl_command captures connection information. This table by default only stores 14 days of information. You could take a look at this similar question: Find out the users that has logged-in to TFS in last 6 months
You could setup another database and have a job to copy information for longer term use. Details please refer this sample.
After reading this and couple related threads I found the following worked great for me (on TFS2015U3):
USE [Tfs_YourTeamProjectCollectionNameHere] -- Optional if you already have Query connected to your TPC.
SELECT IdentityName AS [User], Max(StartTime) AS [LastConnect] FROM tbl_Command with (nolock) GROUP BY IdentityName ORDER BY [LastConnect] DESC
Last Login for each user - per www.databaseforum.info/30/1174675.aspx (likely scraped from some other original source)
and legit reference "What's My Server Doing?" https://blogs.msdn.microsoft.com/jefflu/2005/08/11/team-foundation-whats-my-server-doing/
Cheers and enjoy! -Zephan
Try this utility/command:
tfssecurity /imx all: https://yourtfsserver.company.com
That should print out everything. If anything just look at the help for this tool. It tells you how to do exactly what you're asking for.
It would be in %INSTALL_DRIVE%\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

SQL Server FQDN : Use of IP/Instance unrecognized

Can someone point me to the relevant BOL info for this (odd to me) behavior?
I had to join the prod & staging copies of the same table (same db name, diff servers), for a quick query. So I simply needed a fully-qualified join.
This one errors:
SELECT top 10 *
FROM [172.26.196.105\Staging].[DbName].[dbo].[TableName]
This one works:
SELECT top 10 *
FROM [USCASQL01\STAGING].[DbName].[dbo].[TableName]
Edit: clarification ... obviously not a join, these selects were simply me assembling the fully qualified name of my staging db/table. This is not a linked server, but the one I'm connected to.
These, of course, refer to the same instance. I used the IP address\InstanceName since that is what displays in my Object Explorer, it returned an error - "Could not find server 'IP address\InstanceName' in sys.servers." True enough, sys.servers stores the computerName\InstanceName, which works.
Why would one work and not the other? IOW, Why can't it resolve the IP/Instance name in TSQL when it resolves it just fine in the Object Explorer? BTW, we frequently are storing IP's in sys.servers, this one just happened not to be.
Also, I recall from SQL Server7 (way back in the day), a utility that would allow you to create friendly-name aliases for ip's. Can't find it now, does it still exist?
TIA
This is because the first part of a four part qualified name is a reference to a linked server by name, not by an IP or network name. So, if you don't have the linked server set up, then you get the error you encountered.
For adding linked servers, you want to be looking at sp_addlinkedserver.
This is the BOL Page that describes how the four part names work.

Windows Login Names and their impact on SQL Server 2005

Does anyone know of the impact on SQL Server of adopting 'two part' user Windows Loginnames in the form "fred.bloggs" instead of "bloggsf"?
I have scoured the Microsoft Knowledgebase and can nothing clear about one or the other: only that all examples shown by them are in the 'single word' format.
I have tried to use fred.bloggs ( that is fred dot bloggs ) in some SQL statements and get error messages, so they obviously cannot be used in a straight forward form.
You need to wrap a login like this in brackets, like: [your.login]
There is no impact on the SQL Server engine and performance.
A user name is a user name, whether there is a . in the middle or not.
The only issue is that of how the name is interpreted - ensure you use [] when specifying a user name, otherwise SQL will interpret the part before the . as a schema name.
So, for CREATE LOGIN, you should do:
CREATE LOGIN [xxxxx.yyyyy]