By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,523 Members | 1,938 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,523 IT Pros & Developers. It's quick & easy.

Fatal System Error

P: n/a
Whats happening:
Error#: 40002
Error Item: 01000: [Microsoft...][ODBC...][SQL...]The Statement has
been terminated. > GETID 'INSERT INTO Table(Column1, Column2, Column 3,
Column4, Column5, Column6) VALUES
("","Value1","Value2","Value3","Value4","Value5 ")'

Error Message: 01000: Microsoft...][ODBC...][SQL...]The statement has
been terminated.

Active Form: frmForm
Form Name:
---
GETID Stored Procedure:
---

CREATE PROCEDURE GETID @strsql text AS

PRINT cast(@strsql as varchar(4000))

EXEC(" "
+@strsql + " select @@identity as id")

GO
---
Anyone know what could be causing it? The database has changed - the
frontend code hasn't, so it has to be a database problem. What
happened was a few tables became incorrect so we restored them from a
backup. Everything else seems to work, apart from adding a new record
to this table.
You can edit current records etc..just not add.

Thanks in advance,

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
[posted and mailed, please reply in news]

(lb******@netexperts.co.uk) writes:
Whats happening:

Error#: 40002
Error Item: 01000: [Microsoft...][ODBC...][SQL...]The Statement has
been terminated. > GETID 'INSERT INTO Table(Column1, Column2, Column 3,
Column4, Column5, Column6) VALUES
("","Value1","Value2","Value3","Value4","Value5 ")'

Error Message: 01000: Microsoft...][ODBC...][SQL...]The statement has
been terminated.
...
Anyone know what could be causing it? The database has changed - the
frontend code hasn't, so it has to be a database problem. What
happened was a few tables became incorrect so we restored them from a
backup. Everything else seems to work, apart from adding a new record
to this table.


It appears that one error message has been lost somewhere. "The statement
has been terminated" is an accompanying message to the real error message.

I don't know what sort of client code you are using, but it seems that
the error handling needs a review. When working with SQL Server it's
essential to get all error message. And particularly the first error
message.

As for what have happened, it seems that the definition of the table has
changed, so that the statement is no longer correct. May be there is one
more column which is not nullable. You could also be running into a
key violation. Or, since you had restored some tables from backup, maybe
you are inserting a non-valid foreign key.

Your best bet is probably to run the query from Query Analyzer.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.