Before executing procedure, what is len(@agItem)? Maybe it is truncated before the procedure.
_____________________________________________________
Microsoft Certified Master: SQL Server 2008
XDetails Addin - for SQL Developers
blog.sqlxdetails.com - Transaction log myths