Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 insert into variables -- NUTZ !!

Author  Topic 

bu33ing
Starting Member

1 Post

Posted - 2008-12-10 : 09:16:07
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 ext\pdo_odbc\odbc_stmt.c:133)
----------------

Thanks
B

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-10 : 09:22:52
may be this

"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);
");
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-12-10 : 10:01:48
maybe use a sproc?


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -