does sqlserver have the funtion as same as recno() of vfp?

if not,how can i get the unique numbe of each record?

for example in vfp i can do like this
select *,recno() from tablename

[137 byte] By [jetsu] at [2008-2-15]
# 1
No. SQL Server is set-oriented, not record oriented like VFP. It does not make sense to ask for individual record numbers in SQL Server. Of course you can (should) have a Primary Key that uniquely identifies a record. It does not make sens nor it is good database design to rely on individual record numbers anyway.

Why do you need them? If you want Recno() you can get a recordset from SQL Server using SELECT-SQL and your favorite data access method (CursorAdapter, Remote Views, SQL-Passthrough), that is using ODBC or OleDB and once you have a local VFP cursor, maybe shoing it in a grid you have VFP record numbers.

HTH

AlexFeldstein at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 2
coz i am just doing some test of sql in vfp8 and my friend's dbf doesn;t has the unique filed.so i used recno() to idenfied it,now i want to know it whether does work in sqlserver....
jetsu at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 3

About the only way to achieve this with a single statement in T-SQL is to use a self-join... there are also other ways to achieve this in SQL Server using more than one line:

http://databasejournal.com/features/mssql/article.php/10894_2244821_2

...as Alex has already pointed out, depending on your application, the best way to do this would be in VFP.

P.S. Bear in mind though that both VFP and SQL Server support Identity fields, so this may also provide you with another option/solution.

CraigSBoyd at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 4
thank you guys
jetsu at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...