>>>SELECT [awb_pk]
>>> ,[awb_keycode]
>>> ,[awb_manifestdate]
>>> ,[awb_manifestnumber]
>>> ,[awb_pieces]
>>> ,[awb_weight]
>>> ,[awb_cusfk]
>>> ,[awb_value]
>>> ,[awb_freight]
>>> ,[awb_fuel]
>>> ,[awb_insurance]
>>> ,[awb_number]
>>> ,[awb_shipper]
>>> ,[awb_description]
>>> ,[cus_number]
>>> FROM [dbo].[AirWayBills]
>>> inner join [dbo].[Customers] on awb_cusfk = cus_PK
>>> WHERE
>>> (CHARINDEX(CONVERT(VARCHAR(10), [awb_manifestnumber]), @awb_manifestnumber) > 0)
>>
>>This is bad and incorrect advice. Don't use such code.
>
>Could you explain why?
By two reasons - you will not be able to use an index on awb_manifestNumber if it exists and also your code may produce wrong results, say, your have number 11 in the list, but 1 will be found as a match.
Also, see this great Erland's Sommarskog article where he explains it:
http://www.sommarskog.se/arrays-in-sql.htmlYou can start from the second link (for 2005) although I think he explains it in all the links also.
If it's not broken, fix it until it is.
My Blog