0
insert into <table_name>(<column_name_1>) values(<value>) 
where column_name_0=xyz;

I know this ways it's wrong but I want to find the alternate of this query. Actually I want to insert value to that column only in which the where condition satisfies. Also I have set column_name_0 as primary key and not null

Pranjal Gupta
  • 581
  • 7
  • 10
  • You can't do that with basic SQL. You will have to make a `ProcStock` or a `Trigger` to obtain a similar behavior. The database expects you to just NOT INSERT if you do not want to insert a record. – Guillaume F. Aug 25 '17 at 19:22
  • can you provide me with the query for the trigger to do so? – Pranjal Gupta Aug 25 '17 at 19:23
  • You want to update an existing record that satisfies the `where` condition? Otherwise, if you really want to *insert*, which record you want the `where` clause to conform with? – trincot Aug 25 '17 at 19:30
  • Okey I got the work done with update query!! thanks @trincot – Pranjal Gupta Aug 25 '17 at 19:41

0 Answers0