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 |
Equi join and non equi join is possible with sql server?
What do you understand by physical_only option in dbcc checkdb?
What is 3nf normalization form?
Can we insert data if clustered index is disabled?
What is usually the first word in a sql query?
if 3 duplicate records in table,i want to delete 2 alternating duplicate records by keeping 1 duplicate and 1 original as it is,how?
How would you Update the rows which are divisible by 10, given a set of numbers in column?
Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?
what are the new features introduced in sql server 2000? : Sql server database administration
What is shrink log file?
How to select Distinct columns from the table, table having 20 columns and i want all coulmns
What are functions
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)