stored-procedures

Updating the summary table based on triggers and stored procedures

扶醉桌前 提交于 2021-02-10 14:30:54
问题 I have a typical LAMP based site + Zend Framework where I have a base table and a summary table. Summary table is used to display data in reports. Base table - ID | Status 1 | 1 2 | 1 3 | 2 4 | 2 5 | 1 6 | 1 Summary table - Status | Count 1 | 4 2 | 2 The base table will be changed(insert,update,delete) at an average of 20 times per day. Currently, I am using triggers to call a stored procedure which will update the summary table based on the base table. This is the stored procedure. CREATE

Very slow ExecuteNonQuery (Stored Procedure) vs fast execution using SQL Server Management Studio

做~自己de王妃 提交于 2021-02-10 10:54:10
问题 Although there are many questions on this topic going around, none of the suggestions seem to work. I've got a couple of stored procedures which should be run on a daily basis - some of these stored procedures are quite straight forward, others a bit more tricky. But even the simplest of procedures will run indefinitely when called from a C# program (console) using the SqlClient. This client is running on the server and should be promoted to a windows service when it's actually functioning.

ASP.NET Core stored procedure not working in loop

浪尽此生 提交于 2021-02-10 08:16:51
问题 I want to use a stored procedure for DB query, it works for a single query, but in loop, it executes like in first loop iteration. var getAutoResults = new List<List<Karat_getAutoData_Result>>(); foreach (var elem in meas) { getAutoResults.Add(await _context.KaratGetAutoDataResults .FromSql($"dbo.Karat_getAutoData @MeasurementId = {elem.MeasurementId}, @CalcRequestId = {null}") .ToListAsync()); } After this I get N times the same results, but all ids are different. 回答1: I can resolve it only

ASP.NET Core stored procedure not working in loop

Deadly 提交于 2021-02-10 08:14:56
问题 I want to use a stored procedure for DB query, it works for a single query, but in loop, it executes like in first loop iteration. var getAutoResults = new List<List<Karat_getAutoData_Result>>(); foreach (var elem in meas) { getAutoResults.Add(await _context.KaratGetAutoDataResults .FromSql($"dbo.Karat_getAutoData @MeasurementId = {elem.MeasurementId}, @CalcRequestId = {null}") .ToListAsync()); } After this I get N times the same results, but all ids are different. 回答1: I can resolve it only

ASP.NET Core stored procedure not working in loop

寵の児 提交于 2021-02-10 08:14:25
问题 I want to use a stored procedure for DB query, it works for a single query, but in loop, it executes like in first loop iteration. var getAutoResults = new List<List<Karat_getAutoData_Result>>(); foreach (var elem in meas) { getAutoResults.Add(await _context.KaratGetAutoDataResults .FromSql($"dbo.Karat_getAutoData @MeasurementId = {elem.MeasurementId}, @CalcRequestId = {null}") .ToListAsync()); } After this I get N times the same results, but all ids are different. 回答1: I can resolve it only

ASP.NET Core stored procedure not working in loop

旧街凉风 提交于 2021-02-10 08:13:14
问题 I want to use a stored procedure for DB query, it works for a single query, but in loop, it executes like in first loop iteration. var getAutoResults = new List<List<Karat_getAutoData_Result>>(); foreach (var elem in meas) { getAutoResults.Add(await _context.KaratGetAutoDataResults .FromSql($"dbo.Karat_getAutoData @MeasurementId = {elem.MeasurementId}, @CalcRequestId = {null}") .ToListAsync()); } After this I get N times the same results, but all ids are different. 回答1: I can resolve it only

ASP.NET Core stored procedure not working in loop

醉酒当歌 提交于 2021-02-10 08:10:48
问题 I want to use a stored procedure for DB query, it works for a single query, but in loop, it executes like in first loop iteration. var getAutoResults = new List<List<Karat_getAutoData_Result>>(); foreach (var elem in meas) { getAutoResults.Add(await _context.KaratGetAutoDataResults .FromSql($"dbo.Karat_getAutoData @MeasurementId = {elem.MeasurementId}, @CalcRequestId = {null}") .ToListAsync()); } After this I get N times the same results, but all ids are different. 回答1: I can resolve it only

ASP.NET Core stored procedure not working in loop

Deadly 提交于 2021-02-10 08:10:41
问题 I want to use a stored procedure for DB query, it works for a single query, but in loop, it executes like in first loop iteration. var getAutoResults = new List<List<Karat_getAutoData_Result>>(); foreach (var elem in meas) { getAutoResults.Add(await _context.KaratGetAutoDataResults .FromSql($"dbo.Karat_getAutoData @MeasurementId = {elem.MeasurementId}, @CalcRequestId = {null}") .ToListAsync()); } After this I get N times the same results, but all ids are different. 回答1: I can resolve it only

How to call MySQL stored procedure with multiple input values from ASP.NET

怎甘沉沦 提交于 2021-02-10 06:39:05
问题 This is my MySQL stored procedure. create procedure InsertIntotblStudentProc (PStudentId VARCHAR(10), PStudentName VARCHAR(10)) begin insert into tblStudent (StudentId, StudentName) values (PStudentId, PStudentName); end; Here's my ASP code. `MySqlCommand cmd = new MySqlCommand("InsertIntotblStudent", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("PStudentId", TextBox1.Text);` I stopped here as I want to call procedure with two parameters and my other

Calling a REST API from a trigger or stored procedure in mysql?

半腔热情 提交于 2021-02-09 10:52:54
问题 I want to call rest api in a POST method from a stored procedure or trigger in mysql server on windows. How do I perform this solely with MySQL? 回答1: You can use a mysql-udf-http and then create a trigger like this: delimiter $$ CREATE TRIGGER upd_check BEFORE UPDATE ON account FOR EACH ROW BEGIN IF NEW.amount > 0 THEN set @json = select json_object(account_id,amount) select http_post('http://restservice.example.com/account/post',@json); END IF; END;$$ delimiter; 回答2: Basically you can't. And