sql server - Update values depends on Condition in sql Procedure -


Hello I have a table that contains four columns. I need to avoid duplicate service names for specific server IDs I have but I do not want to check the details. Specifically the server or two services have the same details name.

Table: -

  idat, server id int, savanam varchar (200), details varchar (400)  

Process: -

  create process sp_UpdateServices (@id int, @ ServerId int, service name varchar (500), @ details varchar (400 ), @ Return Message Navigation (500) = Null Output as BEGIN BEGIN is available (select from tbl_servicename servicename where servicename = @ ServiceName and serverid = @ ServerId) RAISERROR ('service name (@@ trancount & gt; ) Rollback Tran SELECT @ Return Message = ERROR_MESSAGE () ReturnMessage END as Catch & @ReturnMes Sage Select  

Output: -

  ID server service name Description 37 9 218 test1 test1 385 218 test2 test1  

Problem: -

I got the error if I try to save test1 for both test1 and test1 for the service name.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -