Txt content to sql query

Hi

  1. I got below sql query. for customerId is also changeable depends on each time text content’s value. how do I write customerId as a variable?

  2. if phoneNo and customerId both have no result in SQL.
    eg. if phoneno = 123456789 and customerId_no = 2345678 both shows no record in SQL, how do i give out the result in excel with phoneno = 123456789 / customerId_no = 2345678 also shows in table but shows ‘No record’ as customerName?

image

the below is my sql query, not sure how to change the last part of SELECT 0 as phoneNo and 0 as customerID to variable

IF EXISTS (select phoneNo, custoomerId, customerName, streetno from data where
phoneNo (‘" + String.Join("’,‘",TxtFileName) + "’)“)
BEGIN
select phoneNo, custoomerId, customerName, streetno from data where
phoneNo ('” + String.Join(“‘,’”,TxtFileName) + “')”) or customerId like ‘22222%’
END
ELSE
SELECT 0 as phoneNo, ‘No record’ as customerName, 0 as customerId, 0 as streetno