Friday 24 June 2016

How to find the existence of a Value in SQL SERVER



In this post we are going to see how to find the existence of a value in SQL SERVER

Execute a two different code , based on occurrence of value in element

--Exist
IF @employeedata.exist('(/Emps/Emp[@dept="HR"])[1]') = 1
BEGIN
  SELECT 'Employee Exist in HR dept'
END
ELSE
BEGIN
      SELECT 'No employee exist in HR Dept'
            END







No comments:

Post a Comment