I need to quickly execute stored procedure which updates table with data from different data source in SQL Server. Is it possible to do it with EF7, I have tried FromSql, but this seems to only works with the mapped entities.
It doesn't need to return anything, just execute.
Is there any other method than using SQLConnection, or SQL job running every 10 minutes on the server?
I think you can use DbContext.Database and ExecuteSqlCommand to execute your stored procedure.
_db.Database.ExecuteSqlCommand("EXEC mySp");
Related
I've setup a BizTalk design that chains a couple of send/receives to a SQL stored procedure (which inserts the data to relevant tables).
It's organised in a specific sequence, so data goes into Table A, and following tables after this check that the data exists in Table A at the Stored Procedure level (simple (IF EXISTS in Table A setup...).
I've noticed though that the flow isn't consistent further down the chain, almost as if SQL is executing the stored procedure to insert/update the record slower than the BizTalk transaction is occurring.
I've made sure that my Biz design is send/receive, as I assumed the transaction wouldn't progress until Biz received a response from the stored procedure (which would indicate SQL has finished inserting the required data).
The below example highlights where the process writes data to the Person table, but is later called upon by the Student Programme/Student Module. Occasionally, it will dehydrate on the Programme or Module stored procedure (from what I can tell, because the stored procedures are looking to see if a Person record created at the start of the flow exists)
Can anyone please confirm if;
Send/Receive will wait for a SQL stored procedure to finish executing before progressing the BizTalk transaction further through the orchestration?
BizTalk Orchestrations have some smarts built into it, if there are no dependencies in the next shapes on the response, then no, it might not wait for the response to execute the next shapes. What you can try is to enable the Delivery Notification to Transmitted on the Logical Send Port settings.
I'm calling a java stored procedure from oracle. After i called execute() method it is never coming out of SP execution and locking the tables. But after i stop the server, the records are getting inserted into tables. Any one face similar issue?
Got the solution. Before calling the SP, i'm doing many insert and update statements and they are locking 5 to 6 tables. I committed the transaction before calling the SP and after that my SP is running fine.
I have two oracle forms and reports server.
oracle forms and reports server 11gr1 (weblogic 10.3.5.0)
oracle forms and reports server 11gr2 (weblogic 10.3.6.0)
both are connected with same database but at time of update data on database new server(11gr2) taking twice or more then that, time for data update compare to old one (11gr1).
I have checked deployed form and procedure inside that form they are same.
further analysis:
form has a PROCEDURE which update data in database and do some IO operation.
found that this PROCEDURE takes more time on 11gr2 compare to 11gr1.
Issue resolved, it was slow due to SYNCHRONIZE was used inside of loop in plsql code in FORM.
I need help in creating logs in a stored procedure.
Scenario is like:
I am creating a procedure. I need to log some intermediate information from the procedure in a log file, such that each time the procedure is executed the logs are generated.
Normally i was using SPOOL for this purpose, but as SPOOL is SQL PLUS and cannot be used in PL/SQL, i was look for a better way through which logs written to specific file each time the procedure is triggered informing the updates which are made in the procedure.
Can someone please help me in identifying any such code snap which i can insert in the stored procedure in order to meet my requirement.
NOTE: I am using Oracle.
You could simply create a package with simple logging functionality, which opens, writes and closes a log file that is stored on the database server. Look into the UTL_FILE package;
We noticed in a SQL Server Profiler trace that this proc is being called:
sp_procedure_params_managed
Each call has 350+ reads in the trace!
We are using Microsoft.Practices.EnterpriseLibrary.Data in an ASP.NET front end.
How can we eliminate these stored procedure calls? We are not explicitly calling it in code.
I'm running Sql Server 2005 and Enterprise library 3.1.0.0.
sp_procedure_params_managed is used determine the stored procedure parameters. I guess the Microsoft.Practices.EnterpriseLibrary.Data uses it to determine what the parameters are for the stored procedure call. It will probably cache the results to prevent extra overhead.