Insert into SQL table
Posted on 2002-06-20
I'm having a little difficulty doing something I've done many times before. I, currently inserting into a SQL database with 4 fields. To of them can be null and two can't. The ICWAEmpID is a number and the other three are text fields. Below is my SQL and below that is the error I get when I don't put a value into one or both of the not required fields (which can be null). Any ideas?
<cfquery name="InsertICWA" datasource="ddssprojdev" dbtype="ODBC">
INSERT INTO ICWA (Salco, ICWANO, BudgetNo, ICWAEmpID)
VALUES ('#FORM.Salco#','#FORM.ICWANO#', '#FORM.BudgetNo#', #FORM.SelectOwner#);
Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 2: Incorrect syntax near ')'.
SQL = "INSERT INTO ICWA (Salco, ICWANO, BudgetNo, ICWAEmpID) VALUES ('333333', '11111', '', )"
Data Source = "DDSSPROJDEV"
The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (53:3) to (53:68) in the template file I:\WEBSITES\DDSSPM2\UPDATE\ADDICWA_APP.CFM.