开发者

Add/modify SQL table

开发者 https://www.devze.com 2023-01-09 16:07 出处:网络
Trying to determine best way t开发者_StackOverflow中文版o code this requirement : Need to insert rows to a SQL table having a multiple key index (PlantID,Year,Month).

Trying to determine best way t开发者_StackOverflow中文版o code this requirement :

  • Need to insert rows to a SQL table having a multiple key index (PlantID,Year,Month).
  • Row may already exist could update or delete existing row.
  • Row contains around 150 fields that is dirived form other SQL tables.

Trying to determine simplest way to accomplish , I have thought would like to use SQLDataAdaptor, any ideas would be appreciated.


The SQL Query is easy:

Delete any existing rows first.

DELETE FROM table WHERE PlantID = "..." AND Year = "..." AND Month = "..."

And now insert the new one:

INSERT 
     INTO table (PlantID, Year, Month, other_col_1, ..., other_col_n)
     VALUES("...", "...", "...", "...", ..., "...")
0

精彩评论

暂无评论...
验证码 换一张
取 消