I have a stored procedure that uses OPENQUERY with ADSI to access Active Directory like this.
SELECT ADsPath, displayName, sAMAccountName, mail, userPrincipalName, manager
FROM OPENQUERY(ADSI, '<LDAP://...>;(&(objectCategory=user)(objectClass=user));manager,userPrincipalName,mail,sAMAccountName,displayName,ADsPath;subtree')
It executes successfully in SSMS but when I use it as a data source in an SSRS report, I get this.
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'DSMAIN'. (rsErrorExecutingCommand)
An error occurred while preparing the query
"LDAP://...;(&(objectCategory=user)(objectClass=user));manager,userPrincipalName,mail,sAMAccountName,displayName,ADsPath;subtree"
for execution against OLE DB provider "ADSDSOObject" for linked server
"ADSI".
When I go back to the stored procedure and comment out the OPENQUERY part, the report will run successfully and remaining data will be displayed as normal. When I include the OPENQUERY again, it will stop working again.
Why does it run from SSMS but not from SSRS? It might be an issue with permissions, however the user account used by report server appears to be able to access Active Directory elsewhere (e.g. ADUC).
Related
I have connected to a Datamart via SSMS. Behind the Datamart is an Azure SQL database.
I am trying to find out my username. I used the following query:
SELECT USER_NAME();
I get this error:
Unsupported sql function USER_NAME. Line:1, Position:8
I have combed the internet but I have not come across something that works yet.
in MS SQL SERVER you must use
SELECT CURRENT_USER;
The op wrote in the comment, that he needed to close the open query box and open a new one, after that it works, like a charme.
or to get the windows user mame of the logged in user
SELECT SUSER_NAME() LoggedInUser
In SQL Server 2014 I have a data driven subscription that is executing successfully, but no file is generated. It is a Windows File Share subscription and the report has three parameters. I've tried removing all the parameters to see if it was an issue with that, but it still does not work. I've also verified the file path and the query the subscription is based is correct so don't think there is an issue there.
The subscription returns the message:
Processing: 0 processed of 281 total; 0 errors.
EDIT #1:
More information:
I'm trying to save the files to a shared drive on test computer.
I've given "full control" rights to the service for SQL Server Agent and
SSRS to the folder.
I'm logged in as a user on a domain.
Images of steps followed:
EDIT #2:
I'm getting the following errors from the log file located at "C:\Program Files\Microsoft SQL Server\MSRS12.MYINSTANCE\Reporting Services\LogFiles"
1) Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException: AuthzInitializeContextFromSid: Win32 error: 1355, Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException: The report server has encountered a configuration error. ;
2) Error occurred processing subscription XX: Failure writing file filename : The report server has encountered a configuration error.
3) Microsoft.ReportingServices.Diagnostics.Utilities.RSException: The report server has encountered a configuration error. ---> Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException: The report server has encountered a configuration error.
You can check the Subscriptions table in the ReportServer database for more detail about the subscriptions. For more detail, you can refer to the How to monitor report subscriptions.
You can check the UserName column values the user have permissions and other details.
SELECT *
FROM ReportServer.dbo.Subscriptions AS s
JOIN
ReportServer.dbo.Users AS us
ON us.UserID = s.OwnerId;
At the same time you can check the ExecutionLog3 table RowCount column in order to figure out the subscribed report returned any rows.Therefore, you can find out more details about the issue of the report.
EDITED
I simulated your error in my SSRS and then handled the problem with the help of the following steps.
Checked the error log files of the SSRS and find out the find out the
"An impersonation error occurred using the security context of the
current user"
error.
At first I refered to Configuration Manager Report Subscription to File Share fails with “An impersonation error occurred using the security context of the current user.” link but it didn't help to me.
Create a new data-driven subscription
Change the path share \ComputerName\Share to \ComputerName\c$\Share
In the data-driven subscription settings, I set the admin account to User name and Password fields.
In SQL Server Data Tools 2015, I would like to move data from a SQL Server 2012 database into a new access database(2005) and need to create the access table as part of the process. Can this be done all in one Execute SQL process under control flow. This will be part of a loop to run through a list of tables that need to be dynamically created and loaded into an empty access db.
I have created a connection manager and that is in the connection field for the access database and put the code into the SQL statement field under the general tab of the Execute SQL Task component.
Both databases are on my local machine.
"SELECT a.* into providers from OPENROWSET('SQLNCLI', 'Server=localhost;Trusted_Connection=yes;', 'SELECT * FROM newResults.dbo.providers') as a"
I get the following error:
SSIS package "C:\Users\chris\source\repos\Integration Services
Project5\Integration Services Project5\Package1.dtsx" starting. Error:
0xC002F210 at Execute SQL Task 2, Execute SQL Task: Executing the
query "SELECT a.* into providers from OPENQUERYSET('SQLN..." failed
with the following error: "Syntax error in FROM clause.". Possible
failure reasons: Problems with the query, "ResultSet" property not set
correctly, parameters not set correctly, or connection not established
correctly. Task failed: Execute SQL Task 2 SSIS package
"C:\Users\chris\source\repos\Integration Services Project5\Integration
Services Project5\Package1.dtsx" finished: Success.
The SQL contained in the Execute SQL Task is executed in the destination's context. The SELECT INTO FROM OPENQUERYSET statement is being passed to Access. Access doesn't have the OPENQUERYSET function and even if it did, your source is SQL Server, which Access doesn't know about unless you have made a connection to SQL Server in Access. Copy your SQL statement into Access and try to execute it and you'll see the same or a similar error. That's what the Execute SQL Task is doing.
Dynamic data is one of the more challenging problems in SSIS. The COZYROC tools include a lot of support for handling dynamic scenarios. Check out the videos for their Data Flow Task Plus for some ideas.
I try to debug a problem related to tfs report,I don't know why and really need help.
Recently I export one report from the old tfs server and deploy to the new server, I also copy the store procedures which related to this report in the old server database to the new server database.
But the report just doesn't work. The error is as following, The report rdl file and store processors in new tfs server are exactly same like the old server, just didn't work for the new one.
An error occurred during client rendering.
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'DataSet1'.
(rsErrorExecutingCommand) Query (1, 16) Parser: The syntax for
'#TFS_Date' is incorrect.
First of all, I would suggest you to check your reporting service log files from below path,
C:\Program Files\Microsoft SQL Server\MSRS11.SQLEXPRESS\Reporting Services\LogFiles
Usually the error messages here in log file shows us a perfect solution.
In your case, try to check that user has access to dataset1's database. (server database) by going to SQL Server Security tabs.
Also, check your store procedure. If you have joined with some other database's table then user must have access of that database too.
Note: This type of error messages you can find there in log file. So read it to solve the issue.
I have subscriptions that are failing to run giving the error:
Failure sending mail: An error has occurred during report processing.Mail will not be resent.
The report runs fine when requested manually through the server so I know the datasource and connection work.
Inside the SSRS database the only information I can get is from the ExecutionLogStorage saying:
rsProcessingAborted
The ExecutionLogStorage table also shows the TimeStart and TimeEnd being 1 second apart, on a report that takes 2+ minutes to run manually. The report has not failed a single time when running manually, only fails through the subscription.
The windows event viewer does contain some errors about a TERADATA extension but they do not coincide with the subscription failures.
The logs located in \Program Files\Microsoft SQL Server\MSRS10_50.Reporting\Reporting Services\LogFiles do not even contain an entry for that subscription during failure at all.
I'm not sure where to go for more information, I need to know why this subscription is failing, we have the workaround of manually running the report and manually emailing it out after converted to excel but that's not a viable solution going forward.
Some other places you could check are:
SSRS Log:
c$\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\LogFiles
You could try enabling verbose logging (level 4) here
C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin\ReportingServicesService.exe.config
Look for this tag:
<switches>
<add name="DefaultTraceSwitch" value="4" />
</switches>
I'm fighting very similar issue but to make it a bit complex, my subscription fails only every other time or so and runs fine sometimes. So far I ruled out:
No. of parallel SSRS sessions
Memory pressure on DB server & Report
Server Kicking off the subscription directly vs remotely(running
the agent job)
Sorry, I do not have a good answer for you but this issue seems to bother more than few people.
Update:
I found out that the Subscription was a created by a windows user who is no longer valid (ID expired). Updating the Subscription owner fixed it.
-- List SSRS users (check to make sure the new Owner exists in this list)
SELECT *
FROM Users
WHERE UserName IN ('DomainName\_SSRSServiceAccount')
-- DFGRYH-DFGRYH--DFGRYH-DFGRYH
-- Identify the subscription whose ownership you would like to edit
SELECT *
FROM Subscriptions
WHERE OwnerID = 'DFGRYH-DFGRYH--DFGRYH-DFGRYH'
AND Description = 'Send e-mail to RichG#DomainName.com'
ORDER BY LastRunTime
,LastStatus
-- Update the Subscription with new Owner, the change should reflect on the SSRS reports
UPDATE Subscriptions
SET OwnerID = 'DFGRYH-DFGRYH--DFGRYH-DFGRYH'
WHERE SubscriptionID = 'B33A78FC-933D-47DB-AB50-43D36B24C0B8'