Link to home
Start Free TrialLog in
Avatar of Andrew
AndrewFlag for United States of America

asked on

ASP SQL Query string syntax issue.

Can someone please help me to understand why I am getting this error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'Lab@xyz.org'.

/trainingSessions/SQLRuns2.asp, line 58


 strSQL3 = "UPDATE _Employees SET Pager = e.LName + ""Lab@xyz.org"" FROM _Employees e INNER JOIN _Department d ON e.reportsto = d.DeptHead WHERE e.isactive = 1 AND e.isScientific= 1 AND e.reportsto = " & Session("strPIID")                                        
 set rsEMP = oConn.Execute(strSQL3)


This is the result in SQL Server Profiler:

UPDATE _Employees SET Pager = e.LName +  "Lab@xyz.org" FROM _Employees e INNER JOIN _Department d ON e.reportsto = d.DeptHead WHERE e.isactive = 1 AND e.isScientific= 1 AND e.reportsto = 7165
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Andrew

ASKER

Ok I changed it to this and am getting this new error:

strSQL3 = "UPDATE _Employees SET Pager = e.LName + 'Lab@xyz.org' FROM _Employees e INNER JOIN _Department d ON e.reportsto = d.DeptHead WHERE e.isactive = 1 AND e.isScientific= 1 AND e.reportsto = " & Session("strPIID")                                        

Microsoft OLE DB Provider for ODBC Drivers error '80040e57'

[Microsoft][SQL Server Native Client 11.0][SQL Server]String or binary data would be truncated.

/trainingSessions/SQLRuns2.asp, line 58

User generated image
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

What is the data type lengths for LName and Pager?  Make sure you have enough room in the Pager column to store the maximum length of the LName columns and the extra 'Lab@xyz.org'
Avatar of Andrew

ASKER

Pager column was varchar(30)
What is LName?  If it is 30, then you might have a problem.