I am new to this and it's something I have to learn on the job. I have a table that gets data imported into it, but some of the fields need to be calculated.
We have a Python script that will import the raw data and I thought it would be better to have all the calcultions for the remaining fields in a SQL Stored Proc that gets run from the python script.
I thought I could use a simple Update statement but getting grief.
The SP will be called for each record - not sure I can do something special in my SP for that other than assume there is only one null record.
I am getting the error:
[Red]
Server: Msg 512, Level 16, State 1, Procedure SP_CalcStuff, Line 3
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.[/Red]
We have a Python script that will import the raw data and I thought it would be better to have all the calcultions for the remaining fields in a SQL Stored Proc that gets run from the python script.
I thought I could use a simple Update statement but getting grief.
Code:
CREATE PROCEDURE .[SP_CalcStuff] AS
UPDATE tblDetail
set Stuff=
(select 55.55-(0.555 * Field1) + (0.066 * Field2)
+ (0.005 * Field1 * Field1)
from tblDetail where Stuff is null)
GO
The SP will be called for each record - not sure I can do something special in my SP for that other than assume there is only one null record.
I am getting the error:
[Red]
Server: Msg 512, Level 16, State 1, Procedure SP_CalcStuff, Line 3
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.[/Red]