Set primary key with two integers

Posted by user299196 on Stack Overflow See other posts from Stack Overflow or by user299196
Published on 2010-03-28T02:14:30Z Indexed on 2010/03/28 2:23 UTC
Read the original article Hit count: 280

Filed under:
|
|
|
|

I have a table with primary key (ColumnA, ColumnB). I want to make a function or procedure that when passed two integers will insert a row into the table but make sure the largest integer always goes into ColumnA and the smaller one into ColumnB.

So if we have SetKeysWithTheseNumbers(17, 19) would return

|-----------------|
|ColumnA | ColumnB|
|-----------------|
|19      | 17     |
|-----------------|

SetKeysWithTheseNumbers(19, 17) would return the same thing

|-----------------|
|ColumnA | ColumnB|
|-----------------|
|19      | 17     |
|-----------------|

© Stack Overflow or respective owner

Related posts about mysql

Related posts about order