Hi

I want to figure out a way to update multiple rows that depend on a couple of variables. I don't really know the syntax in SQL, but I know what I would do in C, so maybe if you could translate this...

switch (x)
     case 0:
           switch(y)
             case 0: myVar = var;
             case 1: myVar = someOtherVar;
     case 1:

.
.
.

Something like that is what I need to do. I could do it all with a bunch of queries but I don't really want to do it that way.

Recommended Answers

All 2 Replies

Hi

I want to figure out a way to update multiple rows that depend on a couple of variables. I don't really know the syntax in SQL, but I know what I would do in C, so maybe if you could translate this...

switch (x)
     case 0:
           switch(y)
             case 0: myVar = var;
             case 1: myVar = someOtherVar;
     case 1:

.
.
.

Something like that is what I need to do. I could do it all with a bunch of queries but I don't really want to do it that way.

In Access it would be something like

Select Case x
    Case 0
        Select Case y
          Case 0
             MyVar = var
          Case 1
             MyVar = SomeOtherVar
        End Select

    Case 1
         Select Case y
             Case 0
                MyVar = OneMoreVar
             Case 1
                MyVar = GotVar
         End Select

    Case Else
          Msgbox "This has not been configured."
   
End Select

Was gonna post some clever SQL, then suddenly remembered this wasn't the SQL Server forum <blush>.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.