Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

If statement in In a sql query

$
0
0
I have a SQL query Generating 2 Random numbers, the first pulls a number 100 - 999, the Second currently pulls a number 1-500.

The problem, I need to insert an if statement to Verify against an ID # in the main table, if the number does not exist I need the random generator to run and pull a new number.

The Code.
Code:

DoCmd****nSQL "SELECT Int((999-100+1)*Rnd()+100) AS RanNum, Int((500-1+1)*Rnd()+1) AS RanID INTO tbl_Temp;"

Viewing all articles
Browse latest Browse all 13329

Trending Articles