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...
-
What is Common Table Expression: Ans: A CTE (Common Table Expression) defines a temporary result set which you can then use in a SELECT...
-
What is SQL Server Profiler: The SQL Server Profiler is a performance tool which included with any version of SQL Server. It generally shows...
-
In this Blog we will discuss how index actually work and help improve the performance of the database. Clustered Index Structure: Employee...