Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

If condition on two columns

$
0
0

Hi All,

I want to verify Bad data and in two columns SPI_1 and SPI_2 in dbo.tabl

If there is null or blank in SPI_1 check other similar column SPI_2 if both columns have NULL or Blank update table as specified

The following script is for one column. Now i want to check two columns and update the statement, I know it can be achievable with IF Statement but syntactically i am missing something..

Please help

update dbo.Table

set active_status='N', remarks='Invalid', EXCEPTION='BADDATA'

whereisnull(AVLBL,'Y') ='Y'

and(SPI_1isnull   orltrim(rtrim(SPI_2))='');


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>