sql server - Match the reference number using left to right and len in sql -


how match referece number left right

using sql server 2010

table1

reference1

abc123456 

table2

reference2

efabc123456 acdererere abc12345693843 

we want compare reference1 reference2 form left right

expected behaviour

table2

reference2  efabc123456 - not match acdererere - not match abc12345693843 - match (its matching complete reference left right reference1 ) 

how make query logic

tried query

left(@pi_ref, len(table1.refno)) = table1.refno rtrim(ltrim(table1.refno)) 

this query working complete referecen number not left right

please assit

table2.refno table1.refno + '%' 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -