Friday, February 10, 2012

converting newId()

Hi there!
Is there any way to convert generated newId() hexa into an int ?
for example, the first two char into an int which won't be greater
than 255
I've searched for 'convert' or 'cast' but i found nothing...
any idea?
thanks a lot
Vince.Why not just use RAND() ?
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Vince .>" <vincent@.<remove> wrote in message
news:qfp541pgb9rfon1nk7cblubersvl3ki0cc@.
4ax.com...
> Hi there!
> Is there any way to convert generated newId() hexa into an int ?
> for example, the first two char into an int which won't be greater
> than 255
> I've searched for 'convert' or 'cast' but i found nothing...
> any idea?
> thanks a lot
> Vince.|||If you just want to convert newid() to int, try:
select convert(int, convert(varbinary, newid()))
"Vince .>" wrote:

> Hi there!
> Is there any way to convert generated newId() hexa into an int ?
> for example, the first two char into an int which won't be greater
> than 255
> I've searched for 'convert' or 'cast' but i found nothing...
> any idea?
> thanks a lot
> Vince.
>

No comments:

Post a Comment