b“Incorrect syntax near the keyword ‘group‘.DB-Lib error message 20018, severity 15:\nGeneral S

created at 05-26-2022 views: 73

error message

(156, b"Incorrect syntax near the keyword 'group'.DB-Lib error message 20018, severity 15:\nGeneral SQL Server error: Check messages from the SQL Server\n")

my code

# insert sql statement
sql = "insert into test4 (name,group) values (%s,%s)"
# perform insert operation
cursor.executemany(sql,dict)
db.commit()

reason

The custom field name conflicts with the default field in the database, keyword 'group'

solution

Change the database column name (for example to groups) and change the code to groups

created at:05-26-2022
edited at: 05-28-2022: