I am stuck with a problem regarding SQL Server and RAND
and varchar to int conversion overflow.
I am trying to assign a random value to CONTRACT_id
.
For instance:
SELECT CONTRACT_ID, RAND(CONTRACT_id)
FROM EUROPE
CONTRACT_ID
has values such as FA15630
and 013789
and is of type VARCHAR(50)
. It seems that RAND()
function is not capable of converting varchar
values to int
. I've tried bigint
, NEWID
doesn't suit my requirements as well because i have duplicated contracts that should have the same RAND
set up number.
Hi SMor, thank you for your clarification. What I am trying to accomplish is having the following
Contract_id Assigned Value
--------------------------------------------------
FA1630 1
0136589 2
FA63987 3
FA1630 1
Thanks!
I appreciate your help. Thanks!
Aucun commentaire:
Enregistrer un commentaire