0

I have 3 tables A, B, C. I have two different INSERT statements to insert into these three tables. I want to have a case statement which will decide which INSERT statement will run for which table depending on some condition. How do i put a case for this.

lIke -- Consider table driving_table-- table_name table_type A STATIC B STATIC
C DYNAMIC

Now i want to have a case which gives INSERT statemnt 1 when table_type = static or INSERT statement 2 when table_type= DYNAMIC

Megha
  • 1
  • 1
  • 5
    CASE is an expression in t-sql. It controls what is returned for a single value in a select statement. It is NOT intended to control flow of statements. For that you need to use IF statements instead. – Sean Lange Oct 12 '15 at 15:52
  • Hey thanks a lot Sean, using IF statement worked. :) – Megha Oct 12 '15 at 17:28
  • http://stackoverflow.com/questions/5996591/insert-into-in-a-case-statement –  Oct 13 '15 at 04:29

0 Answers0