I have the query and only do something when one of the column is not null, see the syntax below. Can anyone help please ?
Thanks
BEGIN
IF Exists (select top 1 corp,price,custname from mytbl where newPrice <> 0) --CONDITION
BEGIN
PRINT 'message1'
END
IF custname from the above query is not null --I don't know the sysntax for this condidion, but basiclly, the message 3 is displayed when custname is null
BEGIN
PRINT 'message3'
END
ELSE
BEGIN
PRINT 'message2'
END
i have found another way of doing this
please correct me if i am wrong
thanks
SELECT *
FROM mytbl;
SELECT abc= CASE
WHEN ( newprice <> 0
AND custname IS NOT NULL ) THEN 'message3'
WHEN ( newprice <> 0
AND custname IS NULL ) THEN 'message1'
ELSE 'message2'
END
FROM mytbl;