T-SQL: How to speed up a JOIN using a CAST & REPLACE expression
Posted on 2013-11-05
In below SQL statement, CAST & REPLACE command is causing performance issue and it was taking very long time to give output.
Please suggest me which command I can use in place of CAST & REPLACE to minimize the query execution time.
CPOA.[PO Number], CPOA.Revision, CPOA.Amount
from dbo.ps_requests_asr ASR with(nolock)
LEFT OUTER JOIN BCAMDB.dbo.CPOA CPOA with(nolock)
ON CAST(REPLACE(REPLACE(CPOA.Inquiries, '[', ''),']', '') AS VARCHAR(50)) = ASR.inq_num
ORDER BY ASR.inq_num,CPOA.Revision