On 31/05/2011 01:04 p.m., Rafael Copquin wrote:
> I am developing a routine that randomly selects inventory items from a
> SQL Server table, for inventory control purposes.
>
> The item code is numeric, ie: 2345, 7867, 127435, etc. However, there
> are less than 2000 records in the table
>
> So I can apply the vfp rand function like so
>
> RandomNbr = int( rand(-1) * 1987 )
>
> to select a specific record, say 469, which could have an id number like
> 8976 and contain an item code like 789678
>
> If I were in VFP I would simply locate for recno() = 469 and get the
> item code.
>
> But, what is the equivalent to the recno() function in TSQL, if there is
> one? And if there is not, how do I get to the particular record?
>
> Rafael Copquin

Maybe :

select IDENTITY(int, 1, 1) as recno, *
into #Temp
from sometable

select *
from #Temp
where recno = 40073

drop table #Temp



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to