Drathier
Drathier

Reputation: 14519

SQL-syntax error

What is wrong with this SQL-syntax?

INSERT INTO chatt (user, msg, ip) VALUES('testUser', 'testMsg', '81.235.154.103')

The server is running some IIS with an unknown SQL version, but the files has to be in access 2000-format. The fields i've got are id, user, msg, ip, datum. 1st one is a counter, last one is a date/time and the rest are text fields. How do i insert into those three fields?

Upvotes: 0

Views: 104

Answers (2)

Adam Robinson
Adam Robinson

Reputation: 185643

Without the actual error message we can't really tell, but two obvious things jump out:

  • user is a reserved word; enclose it in square braces: [user]
  • Your datum field may be not null, which means you need to provide a value for it in your statement.

Upvotes: 2

Mark Wilkins
Mark Wilkins

Reputation: 41222

user may be a reserved word. Try putting it in brackets [user]

Upvotes: 4

Related Questions