SQL Server stored procedure leaves columns blank - sql-server-2012

I have a view and a stored procedure that return the exact same data in SQL Server the only difference being the stored procedure has a parameter.
I need to connect to the stored procedure from Excel, but it fails to return data in a couple of columns. I connected to the view and the same columns are filled with data.
I want to use the stored procedure so I can use the parameter. Any idea why this is happening and what I can do about it?
I'm using Excel 2016 and MS Query with {call dbo.storedprocedure (?)}. The view is also be accessed through MS Query.

Below post suggests that MS Query ignore certain values in case of mixed data type values within same column.
microsoft query from excel file returns empty cells while source file has data in the cells

Related

Is there any way to create an Excel File using an Stored Procedure?

I have a table with this columns: name, surname, email, location and number with their respective data.
Is possible generate an Excel using an Stored Procedure in Azure SQL Database and store this file in my desktop with the results of my querie? Thanks!
"Is there any way to create an Excel File using an Stored Procedure?": Yes.
An SP can do anything and that you can do with T-SQL. How you create the Excel spreadsheet is up to you; SSIS, SSRS, CLR, xp_cmdshell,etc are just a few methods. You'll just need to put the appropriate query and statements in your SP, ensure you have the correct permissions and ensure the service account(s) have the appropriate permissions.
If you're asking how to create an Excel file using SQL Server, that is a completely different question.
In Azure SQL database, most of the ways to export data to an Excel file with T-SQL, such as xp_cmdshell、OPENROWSET(Managed instance only) are not suppported. Even if there's no error when creating the stored procedure, the error will happen after EXEC it.
You will get the error like:
"XXX is not supported in this version of SQL Server".
For local SQL Server, you can reference this tutorial. This tutorial provides a demo stored procedure code for you.
Azure SQL database also provides many other ways to export the data to excel files.
For example, Export SQL table to Excel using SSMS. Using the sql statements to select the data your want to the excel file.
Or you can connect to the Azrue SQL database from your new excel file, get the data you want with sql statements. Please reference the Azure tutorial: Connect Excel to a single database in Azure SQL database and create a report
Hope this helps.
enter link description here

Create dynamic report in Access 2003 from SQL Stored Procedure

I have to create a report in MS Access 2003 that shows data from sql stored procedure. Stored procedure returns data in table matrix. This report will create columns at the run time as column names are not predefined. How can I
Call this stored procedure from the MS Access report?
Create columns in the report at run time?
Thank you.
Create a Pass-Through query that calls the SP, and use that as record source for the report.
The usual way is to create enough columns in the report, and then show/hide them as you need (.Visible property).

Retrieve tables from a stored procedure in SQL Server

ODBC CONNECT TO database_name;
SQL
EXEC procedure_name arg_1, arg_2
I use above code in Qlikview to retrieve the return tables from SQL Server.
However, there are three tables returned from the procedure.
Qlikview shows only one table and its columns.
How to retrieve more than one tables from a procedure?
Thank you very much!
The query results are returned as a multiple result set. The documentation below may help you navigate a multiple result set from Sql server using qlik.
Using multiple result sets served by SQL Server stored procedures

How to store array or record in SQL Server 2008

Anyone please tell me how to store n x n matrix data into SQL Server 2008?
I want to store thousand of pieces of data into SQL Server at the same time from my ASP.NET page so if I pass an array of row and column then how can I store at the same time in SQL Server
Thanks in advance
SQL Server is a relational database, data should at least in 3NF. This means that attributes can't be multivaluates. To store data as you required you have several options:
Normalize data and store it in tables.
Store data array as an XML field.
Move to NOSQL DBMS or any that supports multivalue.
You can set up a stored procedure and pass a DataTable as a parameter to the stored procedure. In your procedure you can then execute a INSERT statement with the data from your DataTable. All you have to do is create and fill your DataTable before you execute the stored procedure.
Here is a link on how to do that. It's written in C# I figured since you're talking about ASP.net this might be it for you.. it should also be easy enough to translate the snippet in VB.net if that's what you're using.
http://www.codeproject.com/Tips/214492/Passing-a-datatable-to-a-stored-procedure-in-Sql-S

How To use a stored procedure in a crystal reports 8.5?

I have to make a new report using crystal report8.5 .
I have created a stored procedure in SQL Server 2005. The stored procedure has one input parameter.
Now I wanna to know that how I can add that stored procedure and show its result in my report
while designing that report?
thank you
First go to File > Options > Database (going from memory) and make sure the checkbox for Stored Procedures is ticked. Then, when you setup your connection to SQL Server, as well as a Tables section you'll see a Stored Procedures one beneath it. Find your stored procedure in the list, add it as the data source for your report, and you'll be able to use it as a normal source.