This is driving me NUTZ ---- SQL Server 2005 and PHP the variable :t_id is being passed from other pages and works in other statements, but is not parsing within this statement. If I replace :t_id with say 30, it works just fine. I tried declaring a new variable and passing it to the statement, and get the same error. define("TF_T_INFO_INSERET", " insert into TFT (WG_ID,task_id,tf_id) SELECT (select WGID from LU_T where TID= :t_id ), :t_id , (select max(TF_ID) from LU_TF); "); ------------output -------------- Performing an upload: insert into TFT (WG_ID,task_id,tf_id) SELECT (select WGID from LU_T where TID= :t_id ),:t_id ,(select max(TF_ID) from LU_T); Binding value :t_id to 30 ------ ERROR --- An error was encountered while saving: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error (SQLExecute[0] at extpdo_odbcodbc_stmt.c:133) ---------------- Thanks B
Not sure that I understand the use of the colon in your syntax - that doesn't appear to be regular T-SQL usage. I assume you need to substitute the :t_id marker in the statement with its value. In that case, I would concatenate the value from the variable into the statement (don't forget to add string or date delimiters where appropriate).