update tableA set Gender = (case gender ='Male' then 'Female' else 'Male' end)
Monday, April 24, 2023
Sunday, April 23, 2023
Create Stored Procedure with output parameter and how to call stored procedure with output.
Create proc with input parameter:
CREATE PROCEDURE Usp_GetEmployee
(
@EmpId int
)
as
begin
select * from Emp where EmpId=@EmpId
end
Create proc with Output parameter:
CREATE PROC Usp_OutPutEmp
(
@EmpId int ,
@empName varchar output
)
as
begin
SELECT @empName= EmpName FROM Emp WHERE EmpId=@EmpId
end
---------------------Call Proc with output Parameter------------
DECLARE @EmpName varchar(30)
exec Usp_OutPutEmp 1,@EmpName output
print @EmpName
How to remove dublicate record in a table
DELETE P1 FROM ProductId AS P1
INNER JOIN PRODUCTID AS P2 ON
P1.ProductId>P2.ProductId AND P1.PName=P2.PName
Subscribe to:
Posts (Atom)
How to use SQL pagination using LIMIT and OFFSET
How to extract just a portion of a larger result set from a SQL SELECT. LIMIT n is an alternative syntax to the FETCH FIRST n ROWS ONLY. T...
-
Difference Between Primary key & Foreign key Primary Key Foreign Key Helps you to uniquely identify a record in the table. It is...
-
Ans: A trigger is a special kind of Stored Procedure or stored program that is automatically fired or executed when some event (insert, d...
-
A tuple is a data structure that contains a sequence of elements of different data types. It can be used where you want to have a data s...