I have a set of records in the temporary table. I need to put them in a file. The requirement is to add sequence number of the records (1 for first record, 2 for second record, etc ..) while writing to the file. The C program just need to copy the data into file. Unfortunately I cannot use C code to write the sequence numbers.
Is there any way to add sequence numbers to the records? Please let me know.
Thank you pdreyer. It worked partially. My net row count is 55. But the index is showing a value of 9099325475709464631. And because of huge value C program is not able to handle. Ideally it is supposed to have 55.
Also when I run interactively identity field id showing 55. But when it is automated it is throwing huge value.
Originally Posted by pdreyer
create the temp table with an identity column
use bcp to create the file (perminant table in tempdb)