I am getting this error and cannot find where my syntax is messed up can anyone please help me with what I am overlooking!
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the
keyword 'Transaction'.
<cfquery datasource="Titlesbymail" name="InsertEntry" result="transactionResult">
INSERT INTO dbo.Transaction (Type, OwnerType)
VALUES (
<cfqueryparam value='NonLeased' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='Owner' cfsqltype='cf_sql_varchar' />
)
</cfquery>
My database looks like this :
The ID should be set up to automatically increment by 1 and the date time should automatically know it based on the getdate() function. So I am very unsure how I am making an error here.
It looks like you have named your table using a SQL reserved word; Transaction
. I would not recommend that as you may run into issues (like you have now).
However, it can be done. Try this and see if it works:
INSERT INTO [dbo].[Transaction] (Type, OwnerType)
VALUES (
<cfqueryparam value='NonLeased' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='Owner' cfsqltype='cf_sql_varchar' />
)
List of SQL Server reserved keywords: Reserved Keywords (Transact-SQL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With