-3

I'm wishing to get the data shown in coln B when using coln A - in essence show me the numbers and return Null in place of text using SQL Server 2016.

Coln A     
123       
qw       
Null        
456      
aa

Coln B   
123   
Null     
Null    
456    
Blank

Thanks in advance for your help.

1 Answers1

0

Based on the comments I'm not sure your question is entirely correct. However the following SQL Fiddle returns the results you have provided.

http://sqlfiddle.com/#!18/abc39/2

select case
  when IsNumeric(ColnA) = 1 then ColnA
  when ColnA = 'aa' then 'Blank'
  else NULL end as ColnB
from MyTable
openshac
  • 4,966
  • 5
  • 46
  • 77