SQL Server INSERT INTO with WHERE clause

后端 未结 7 1155
礼貌的吻别
礼貌的吻别 2021-01-05 05:39

I\'m trying to insert some mock payment info into a dev database with this query:

INSERT
    INTO
        Payments(Amount)
    VALUES(12.33)
WHERE
    Paymen         


        
7条回答
  •  悲&欢浪女
    2021-01-05 06:00

    i do inserts into a table if the record doesn't exist this way. may not be entirely what is after but it may be helpful

    insert into x (a,b)
    select 1,2
    where 0=(select count(*) from x where a = 1 and b = 2)
    

提交回复
热议问题