Sharepoint Data source within SQL Server - sql-server

I have a query which is written in SQL Server and this gives me what I require.
I have a new requirement to add a Sharepoint Data source field on to the same SQL Query and perform some matching against them.
I know how to add a Sharepoint source as a Datasource within SSRS, however not quite sure how this can be implemented within SQL itself?
Note: my front end for the SQL query is SSRS i.e. once all sorted on SQL, I copy across to SSRS and design accordingly.

Related

Linked-Server stored procedure data missing in SSRS

I am building a report in SSRS using Visual Studio 2010 Design view. I am using a stored procedure as my data set. When I run out the stored procedure in SQL Server, it runs fine. When I run it out in preview, I am missing some columns.
In the stored procedure, I join a table that lives on a linked-server through a synonym. These seem to be the missing columns in the preview.
Is there a known issue where linked-server data will not get returned in SSRS even if it compiles in SQL Server?
This is probably due to permissions if you have the linked server set to execute as the context of the current user - it will use the credentials of the Data Source in SSRS.
Is your data source configured to use a specific user? Try running the sproc as that user?
-- Edit based on Comments --
It appears the issue is probably with the linked server authentication. There are a few ways round this;
Set up Kerberos pass-through authentication so you can tick 'Be made using the login's current security context' in the linked server properties
https://blogs.msdn.microsoft.com/farukcelik/2008/01/02/how-to-set-up-a-kerberos-authentication-scenario-with-sql-server-linked-servers/
https://www.databasejournal.com/features/mssql/article.php/3696506/Setting-Up-Delegation-for-Linked-Servers.htm
Use a SQL (not Windows) account on the remote server by ticking 'Be made using this security context' and entering the sql accounts details
Use a scheduled job of some kind to transfer the data the sproc returns over to one server so that linked server connection is not required
Change the report to query both data servers separately (as two different data sources and data sets), then join the results within the report (this is a bit fiddley and not really recommended)

Sql Server 2012 Custom/Standard Reports in SSMS

I want to develop my own Custom Reports in Sql Server. I would want to know the underlying report logic (tables used, joins etc) of the existing Standard reports in SSMS to get an idea. Is it possible to locate the source code (.rdl) of these Standard Reports and get the underlying logic which could be used in my Custom Reports ?
I am using Sql Server 2012
Thanks
SSRS can't use .rdl as data source to retrieve data. For your requirement, you should query the system table to retrieve data into a dataset.

How to get SharePoint to “see” new SQL Views, Tables and Stored Procedures in SQL Server?

I’m trying to define new external content types, I’m able to connect to SQL Server and define external content types from tables, stored procedures and views that were already in the database.
The problem I’m having is that I created a new SQL View in SQL Server with the data I want, but when I try to define a new content type, SharePoint doesn’t show me the new SQL View in Data Source Explorer.
I thought it could possibly be the way the SQL view was created, so I created a new test Table, a new stored procedure but that didn’t work either.
I tried “Refresh All” and deleting and re-creating the connection in Data Source Explorer, but nothing seems to work.
It seems that any views, tables or stored procedures that I created after a certain point in time are not available in SharePoint
I’m using SharePoint 2010 and SQL Server Express Edition with Advanced Services (64bit)
Any help is greatly appreciated.
Thanks in advance,
Silvio

Convert MS Access Reports to SQL Server Reporting

I have a bunch of old reports in MS Access that I want to just move over to SQL Server.
Is this possible to do? What steps need to be taken?
Identify a Report to convert
Open the Report in MS Access in Design mode
Get an old copy of the report or run the report out of MS Access (as the basis of making a SSRS report)
Open the Report Properties and find the Record Source the Report is using: qry_Intermediary_Summary
Goto the Queries tab and right click the Query and choose Design View:
Right click and choose SQL View
Copy the MS Access SQL into SQL Management Studio
Edit the MS Access SQL so it is SQL Server compliant:
Escaped column names that are reserved SQL Keywords (eg GROUP)
Replace double quotes with single quotes
Make sure Table/Views exist
Remove Dollar signs
Convert Trim(...) to LTrim(RTrim(...)))
etc
When a Query uses nested queries we need to convert them to Stored Procedures and load the data in Temporary tables. eg
This SQL uses 3 nested queries:
qryTopStocks
qryTopStocksBuys
qryTopStocksSells​
We cannot make the queries Functions that return Tables because Functions dont support ORDER BY
We cannot turn the queries into Views because Views do not accept parameters
So we have to convert the queries into Stored Procedures:
Then in our DataSets we execute the Stored Procs into Temporary tables that we can join:
Once you have the Query and it is returning the exact results as MS Access (view the old report to check), then we can create a new report.
I have used the MS Access to SSRS conversion tool. It managed to get the MS Access report designs but couldn't extract data. These SSRS2005 version reports are in directory AAA. Copy the Report you are converting from the AAA folder into the BBB project folder.
Import the old SSRS2005 report into BIDS/SSRS2016:
Select all the controls and copy them onto a new SSRS2016 report. Then delete the SSRS2005 report from the project. You only need it to copy the controls retaining the design, fonts and styles.
In BIDS map all the controls to their field in the DataSet.​
UPDATE: I just found this, its quite helpful: https://www.databasejournal.com/features/msaccess/article.php/3705151/Converting-Access-Queries-to-SQL-Server.htm
And this is a really good explanation of MS Access queries vs SQL Server queries for linked dBs
https://www.mssqltips.com/sqlservertip/1482/microsoft-access-pass-through-queries-to-sql-server/

How do I insert a SQL Server result multiple times in a live word document using VB

Ok, I'm stuck trying to figure out how to take a mail merge, use that info to make MS SQL calls and get strings back in a word document. I'm guessing VB but I have no VB experience.
If you want do a mail merge using data from SQL Server then (in Word 2003 anyway) there's an option on step 3 of the mail merge wizard:
Use an existing list > Browse > New SQL Server connection
If you want to take the results of a mail merge from some other data source and then query SQL Server with those results then you're going to need VBA. As well as working out how to manipulate data in the Word object model, you're going to need something like ActiveX Data Objects (ADO) for the database queries

Resources