I need help with declaring a variable in SQL Server. This variable is supposed to be an int that is calculated with the values from each row for the columns of dblelectrodelength and dblelectrodespacing. How would I go about doing this?
Declare @T0 int = ((dblelectrodelength - 1) + 0 * (dblelectrodespacing + dblelectrodelength) + (dblelectrodelength / 2))
DECLARE... = (SELECT col + col)etc. Keep in mind, variables only hold a single value. It seems like you may be intending to calculate this across multiple rows, which would only work in a loop with this approach (there are better approaches if that is the case, but we need more info).