Tuesday, April 2, 2013

Sql query For Existing

Insert Into Employee (Role_ID, FirstName, LastName, DateOfBirth, Active)
Select @Role_ID, @FirstName, @LastName, @DateOfBirth, @Active
Where not exists (
select 1 from Employee where FirstName = @FirstName
and LastName = @LastName
and DateOfBirth = @DateOfBirth
)

If @@rowcount=0 select 'User already exists!'

No comments:

Post a Comment

📱Build WhatsApp Bot using .NET + OpenAI

   In this article, you will learn how to build a real-world WhatsApp chatbot using ASP.NET Core and OpenAI. This bot can automatically repl...