Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 generate a query that numbers each row of result in text file.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-16 : 06:52:12
Rosemary writes "SQL Server 7.0 Windows NT

I am trying to extract data from one database (SQL Server, I have read only access) and import it into another database (Sybase SQL Anywhere 5.0). The second database requires a sequential recordnumber for each row that will be imported.

When completed this will be a script that is scheduled to run on a daily basis and then another script will be scheduled to import the results text file. I have no trouble with the import script if each record is numbered.

I need the results in a comma delimeted text file that would look like the following:
Sequence FNAME LNAME ST
1 Rosemary Lieberman NJ
2 John Smith NY
3 Jane Doe CN

In looking around your site I saw some info I tried.

SELECT emp_id, lname, fname, job_id,
(SELECT COUNT(*) FROM employee ) AS rownumber
FROM employee

The result was that each record had as the rownumber of the total rownumbers in the result

89, Rosemary, Lieberman, NJ
89, John, Smith, NY


I would appreciate any response.

Rosemary"
   

- Advertisement -