Trying to create a view in SQL server 2014 to read the table data in a different format : I am using SQL Server 2014.

Table 'X' consists of a column 'Desc2' in which data is in the format 

'VT000379_001: Low Low Alarm Limit 5'  
'VT000379_001_001: Low Low Alarm Limit 5' .

I am trying to create a view  to remove the '_001' , so the result should be as follows.

'VT000379: Low Low Alarm Limit 5'   
'VT000379_001: Low Low Alarm Limit 5'

The logic i have been trying is

Instr =: = 12

x= left(12) = VT000379_001

if x have 1 undrscore

inst = "_" position 1 =VT000379

if x have 2 undrscore

inst ="_" position 2 =VT000379_001

Can someone help me out on this ?

thanks
sidhu 


