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....
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.
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:
does sqlserver have the funtion as same as recno() of vfp?
Xzion
RFU
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
Matt Anderson
tusAugusto
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.