SQLTeam.com | Weblogs | Forums

Searching only collums with value


#1

Hi all,

CREATE PROCEDURE [dbo].[SP_BACK_Fraud_Block]
@customerid AS INT,
@ordernr AS INT
AS
BEGIN
DECLARE @zipcode AS NVARCHAR(20)
DECLARE @fullname AS NVARCHAR(50)
DECLARE @city AS NVARCHAR(50)
DECLARE @street AS NVARCHAR(50)

SELECT @fullname=fullname, @zipcode=zipcode, @city=city, @street=street FROM dbo.T_Customer WHERE CustomerID=@customerid

--- i got this hard coded

IF @zipcode='1111' OR @zipcode='3302ll' OR @zipcode='1112sw' OR @fullname='Johnr'

i want to get this from a table
(same structure as T_customer, this table will only have values in some columns)

i want to loop thru all rows. and see if there is a match.
and when there are 2 values like row 3, should be @country=country and @phone=phone

Maybe im taking a complete wrong aproach. the idea is to store in table the unique marker or combination of 2 or 3. to block fraud attempts

thanks a lot