开发者

Add/modify SQL table

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜