Need to Update a column B on basis on Column A,
Condition - If Column A(data type-Float) is Negative then Put -1 Sign in Column B and vice versa.
using SQL Server 2014
Need to Update a column B on basis on Column A,
Condition - If Column A(data type-Float) is Negative then Put -1 Sign in Column B and vice versa.
using SQL Server 2014
Use the sign function
update v_table1 set ColumnB= case when ColumnA <0 then -1 when ColumnA >0 then 1 when ColumnA =0 then 0 else null end
Or like I wrote, use the sign function:
update v_table1 set ColumnB=sign(ColumnA)