470,613 Members | 1,772 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,613 developers. It's quick & easy.

Fatal System Error

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
1 3331
[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.

Similar topics

8 posts views Thread by Tim Tyler | last post: by
2 posts views Thread by Gonzalo | last post: by
4 posts views Thread by Jesper Stocholm | last post: by
1 post views Thread by Irakli Lomidze | last post: by
1 post views Thread by Pat Bradford | last post: by
reply views Thread by May | last post: by
reply views Thread by =?Utf-8?B?cGF0cmlja2RyZA==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.