mercredi 31 août 2016

How to randomly generate an Integer in SQL

As the question suggests.

I need to randomly generate an Integer at the end of my SQL query. It is supposed to be part of a code that I have to create from existing variables.

SELECT LEFT(Var1,2) & RIGHT(Var2,1) & RND
FROM MyTable;

The method I used here generates a number that is a decimal like 0,2895625 at the end of the code. I need it to generate a whole Integer.

Thanks Again!




Aucun commentaire:

Enregistrer un commentaire