Þetta sækir öll netföng viðskiptavina sem eru ekki skráð með lögleg netföng (vantar @)


SELECT 

  VENDTABLE.ACCOUNTNUM AS CUSTID,

  DIRPARTYTABLE.NAME AS CUSTNAME,

  CASE LOGISTICSELECTRONICADDRESS.TYPE WHEN 1 THEN 'Phone' WHEN 2 THEN 'Email' END AS CONTACTTYPE,

  LOGISTICSELECTRONICADDRESS.DESCRIPTION AS CONTACTNAME,

  LOGISTICSELECTRONICADDRESS.LOCATOR AS CONTACTDETAILS

FROM DIRPARTYTABLE AS DIRPARTYTABLE

INNER JOIN VENDTABLE ON DIRPARTYTABLE.RECID = VENDTABLE.PARTY

INNER JOIN DIRPARTYLOCATION ON DIRPARTYTABLE.RECID = DIRPARTYLOCATION.PARTY

INNER JOIN LOGISTICSELECTRONICADDRESS ON DIRPARTYLOCATION.LOCATION = LOGISTICSELECTRONICADDRESS.LOCATION


WHERE LOGISTICSELECTRONICADDRESS.TYPE = 2 and isnull(LOGISTICSELECTRONICADDRESS.LOCATOR,'') not like '%@%'