how extract first word using parsename function sql server?

Viewed 19

I have string value given below and code. it is giving me null value. i failed to understand why. can anyone help me out?

string 1- 'DEBRI-MSR001.10.52.249.74' 'hpg-pgs-0003.postgres.database.azure.com'

SELECT PARSENAME('DEBRI-MSR001.10.52.249.74', 1) AS 'Object Name'; 
output : - Null

select PARSENAME('hpg-pgs-0003.postgres.database.azure.com', 1) AS 'Object Name'; 
output : - Null[enter image description here][1]

enter image description here

If I will remove the last word from string it gives me the output.

SELECT PARSENAME('DEBRIMSR001.10.52.249', 1) AS 'Object Name'; 
output : 249
select PARSENAME('hpg-pgs-0003.postgres.database.azure', 1) AS 'Object Name'; 
output : azure

enter image description here

Thanks in advance

0 Answers
Related