I am new to sql server azure.Basically i Need to execute a stored procedure with the parameters which will return the data. I want to know how can i get that data in View Model.Its gives me the message "Child evalution not allowed".I have gone through external tables.
Any help would be appreciated.
Related
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
Using VS 2013 (VB) and SQL Server 2012.
I execute a stored procedure to populate a gridview using linq.
Dim db As New GMConnectionDataContext
Dim gasHedges = db.GasHedges_create2ndMonth.ToList
The stored procedure returns a result set and has been working fine as in it returns the expected result and the gridview displays as desired.
I added some data to my SQL table and loaded the web page and the new data does not show. IF I execute the stored procedure in SQL Server the new data shows. If I execute the stored procedure in VS the new data shows.
Now the weird bit. If I delete the reference to the stored procedure from the .dbml file then re-add it the new data shows when the page is loaded. I know that when using this file if I add columns to a table then I need to delete it and re-add the table to the .dbml file.
Surely the same isn't the case with stored procedures as they would be unusable. Is there something I am missing?
UPDATED
I think I know why this happening but I don't know how to fix it. The SQL result set has dynamic columns as I use the pivot command in SQL. This means that if a user creates a new Gas company the result set will have another column and the datacontext must interpret that as the SP having changed and still shows the old dataset. This does mean I cannot just delete the SP from the datacontext and re-add it as the web application needs to handle if the user adds another company.
Any changes you make in SQL server are not auto-synched to your .dbml file. If you make table or stored procedure changes you need to delete them from the .dbml file and add them again.
Best practices would dictate that you don't pivot your data in SQL. Pivotting data is not a data related issue; it's presentation and should be done in the presentation layer -- in the application.
I am new to learn pentaho reporting tool,
Can anyone tell me how to call stored procedure in pentaho report designer.
In Report designer we have not seen the directly stored procedure .
How will i find out and call stored procedure in report designer ?
If your database is MS SQL server, convert your Store Procedure to Function with table as its result.
if your db is postgres then you can simply write following query:
Select * from As ( ,....);
Here is the columns that you need in report.
CALL SCHEMA.STORED_PROCEDURE (Parameters you wish to pass in)
CALL SCHEMA.STORED_PROCEDURE (Param1, Param2, Param3)
This is with a db2 database but syntax similar for others.
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
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.