Wednesday, March 28, 2012

query using the record number

happy friday...
my table has 200,000 + records and I want to see the particular record which I think it is causing the problem.
How could i query 195,203rd record?
thank you, yanorooWhat problem is it causing? How did you figure out the number to begin with?|||What problem is it causing? How did you figure out the number to begin with?

oh, the record number is just an example.
actual case is -I ran dts package to import data from txt file to sql table.
The dts truncated the table and imported the records correctly (218503 record) but I can't find the data from 208775th record on the table...
I want to see the what was populated into the table from 208775th record.
And strange thing is the table has 237043 record (which is more than input)|||are you getting 237043 by doing a count(*) on the table?|||are you getting 237043 by doing a count(*) on the table?
yes, it is by count(*) on the table.|||If you are just debugging the process, then temporarily create an incrementing identity column on the table.|||If you are just debugging the process, then temporarily create an incrementing identity column on the table.

Hello,

Found out the problem was DTS prod installation error.
Thank you anyway for your suggestion.
Yanoroo|||i suggest in a situation like this to create a staging table when you transfer large amounts of data to an sql server. this way you can set the error count high and allow sql server to leave the rows causing the error in the staging table while you move the clean data to the final destination. you can then have the dts send you an email notifying you of the prob and you can clean those rows in the morning.

go to www.SQLDts.com|||I assume there is an unique field named pid in your table and you are looking for a particular record of pid(in this case 195,203rd).You can try this query--

select * from mytable where pid not in
(select top 195,202 pid from mytable)

If you have any other type of requirement that can be solved too.
Subhasish

No comments:

Post a Comment