How to avoid cursors?
Answers were Sorted based on User's Feedback
Answer / mahima
to avoid cursor use CASE and SET .
to give increment to the employee depending upon the salary
update empsal
set
case when sal between 2000 AND 3000 then sal+1000
when sal between 3000 AND 4000 then sal+2000
end
Is This Answer Correct ? | 6 Yes | 3 No |
1.By using case.. set,we can avoid the cursors
2.By using temporary tables/table variables/CTE
with while loop we can avoid cursor in the transaction.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / sunny
update salary set sal=(
case
when sal between 100 and 300 then sal + 1000
when sal between 300 and 500 then sal + 2000
when sal between 500 and 700 then sal + 3000
end)
Is This Answer Correct ? | 2 Yes | 1 No |
What is referential integrity? What are the advantages of it?
4 Answers Descon, Digital Domain,
About Indexed Views? with example? plz reply...
To which devices can a backup be created and where should these devices be located? : sql server management studio
What is sql server profiler?
What are the differences between lost updates and uncommitted dependencies?
How to create a stored procedure with a statement block in ms sql server?
What is difference between inner join and full join?
Can we passed multiple recordset(set of records) using a Stored Procedure
Explain system views?
What is dirty read?
What is spid in sql server profiler?
What is a non clustered primary key?