inserting wrong number of records
-
Hi, My job is to read a text file and insert all the records from that text file to a database table. I have partly done that. There is an identity field in the table named
record_id
. I am buliding the sql insert insertment taking values from text file and inserting records. Everything is fine as long as the number of records are less, say, 50 or 100 or 150. If the number of records goes above that all the records are not inserted. As against 766 records only 606 records are inserted. Also the autoincrement field should increment uniformly. But it is not happening so. What is the problem ? Is there a sql server problem or some logic problem. Any suggestion is welcome :confused: -
Hi, My job is to read a text file and insert all the records from that text file to a database table. I have partly done that. There is an identity field in the table named
record_id
. I am buliding the sql insert insertment taking values from text file and inserting records. Everything is fine as long as the number of records are less, say, 50 or 100 or 150. If the number of records goes above that all the records are not inserted. As against 766 records only 606 records are inserted. Also the autoincrement field should increment uniformly. But it is not happening so. What is the problem ? Is there a sql server problem or some logic problem. Any suggestion is welcome :confused:How are you checking what records has been added?
DownBySpj wrote:
As against 766 records only 606 records are inserted.
Are you catching exceptions and ignoring them, or something? I have yet to see an insert statement that fails without sending an error message.
DownBySpj wrote:
Also the autoincrement field should increment uniformly. But it is not happening so.
What happens, then?
--- b { font-weight: normal; }
-
How are you checking what records has been added?
DownBySpj wrote:
As against 766 records only 606 records are inserted.
Are you catching exceptions and ignoring them, or something? I have yet to see an insert statement that fails without sending an error message.
DownBySpj wrote:
Also the autoincrement field should increment uniformly. But it is not happening so.
What happens, then?
--- b { font-weight: normal; }
hi, In the inserting module i am incrementing a counter if there is a sucessfull insert. This lets me know about the number of records that are processed by the code. And in the database table, i use just " select * " statement to know exactly how many records are inserted. Before the insertion table is empty. So the number of records returned is the number of records inserted by the code. But there is a problem somewhere, that's why it is showing me wrong no. I am first reading the whole file in a string array. This way it becomes cler about, how many records are there, and then i inserts the records one by one. But it is happening so. If an exception regarding primary key, or foreign key or any other, i am incrementing a counter for errors. But the probelm is it is not showing any error. Any help :doh:
-
hi, In the inserting module i am incrementing a counter if there is a sucessfull insert. This lets me know about the number of records that are processed by the code. And in the database table, i use just " select * " statement to know exactly how many records are inserted. Before the insertion table is empty. So the number of records returned is the number of records inserted by the code. But there is a problem somewhere, that's why it is showing me wrong no. I am first reading the whole file in a string array. This way it becomes cler about, how many records are there, and then i inserts the records one by one. But it is happening so. If an exception regarding primary key, or foreign key or any other, i am incrementing a counter for errors. But the probelm is it is not showing any error. Any help :doh:
DownBySpj wrote:
And in the database table, i use just " select * " statement to know exactly how many records are inserted.
Yes, but what are you using to run the query? If you for example run it from the code right after inserting the records, but are using a different connection than the one used to insert while the first connection is still open, some records might not show up yet although they exist. What does the insert query look like? Are you sure that it always results in inserting a record? If you for example select data from another table in the insert, are you sure that you always get a record from that table?
--- b { font-weight: normal; }