Hi I think the problem is in the where part of your SQL if AgentRef is a varchar column then you should rewrite the where part as WHERE Order_Details.Qref = Order_Header.Qref AND Order_Header.AgentRef like '48976' or WHERE Order_Details.Qref = Order_Header.Qref AND Order_Header.AgentRef ='48976' HTH Mustafa ----- Original Message ----- From: "LOUD, Mark" <Mark.LOUD@eur.crowncork.com> To: <php-db@lists.php.net> Sent: Thursday, June 26, 2003 10:29 AM Subject: MSSQL VIRTUAL TABLES > Hi, > > I am trying to do the following query in a MSSQL 2000 database: > > SELECT Order_Details.Qref, Order_Header.AgentRef > FROM Order_Details, Order_Header > WHERE Order_Details.Qref = Order_Header.Qref AND Order_Header.AgentRef = > 48976 > > I get the following error: > > Syntax error converting the varchar value 'I7502203' to a column of data > type int. > > Now this value 'I7502203' is in the Order_Header table in the AgentRef > column (which is a varchar column). Obviously when the query is run the > results will be put in a virtual table but why is it creating the virtual > field of Order_Header.AgentRef as an int when in the original table it is a > varchar? Can this be pre-set in the query? > > Any ideas would be handy > > Mark Loud > > > > > CONFIDENTIALITY NOTICE > The information contained in this e-mail is intended only for the > confidential use of the above named recipient. If you are not the intended > recipient or person responsible for delivering it to the intended recipient, > you have received this communication in error and must not distribute or > copy it. Please accept the sender's apologies, notify the sender > immediately by return e-mail and delete this communication. Thank you. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php