I have a table in SQL Server Express 2019 from which I read data by executing basic queries from my SCADA software. How can I create a column in the table containing a row number such that when I delete a row, all values in the column are automatically recalculated? My SCADA software can only execute simple, one-line queries. Is a computed column the answer? I started with an Identity column, but it does not update when a row is deleted. Thank you.
1条答案
按热度按时间elcex8rz1#
It's normally process when you define identity column. Why you want automatically recalculation ? I think that it's not best practice but you can do it with trigger. The trigger will degrade your database performance.