I`m currently recieving data from sensor and storing it to Azure SQL database through Azure Stream Analytics job.
My question is: how can I overwrite old data from sensor with new data? Sensor has its own ID, so is it possible to overwrite data by sensor ID.
Azure SQL Database – Overwriting Old Data
azure-sql-database
Related Question
- SSMS 2014 – Deploy Database Feature with Old SQL Azure Settings
- Sql-server – Continuous replication between Oracle Database and Azure SQL Database
- SQL Server – Migrating or Exporting Database from Azure to SQL Server 2016
- Azure SQL Database – Managing External Data Sources
- Azure SQL – How to Copy Real-Time Data to Azure Data Warehouse
- Migrating Azure SQL database to Azure sql Managed instance
Best Answer
You can use a MERGE statement to perform a conditional INSERT/UPDATE (sometimes called UPSERT) of data in your table.
Example:
This statement will match records in IoInput with existing records in Output. Any matched records will update the ParkingStatus in Output with the value in IoInput. Any unmatched records in IoInput will be inserted into Output.