We need to perform what steps in the following order to work with a cursor?
Answer Posted / Mukul Kumar
To work with a cursor in SQL Server, you must follow these steps:
1. Declare the cursor using the DECLARE statement.
2. Open the cursor using the OPEN statement.
3. Fetch rows from the cursor using the FETCH statement.
4. Optionally, perform operations on the fetched row(s).
5. Close the cursor using the CLOSE statement.
6. Deallocate the cursor using the DEALLOCATE statement.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
What is normalization and what are the advantages of it?
What is temporary table in sql server? Why we use temp table?
Why we use the openxml clause?
What is the difference between for xml raw and for xml auto?
How do I start sql server 2017?
What is a scheduled job or what is a scheduled task?
How do I find the sql server version?
Can we shrink data file in sql server?
Is it possible to have clustered index on separate drive from original table location?
This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?
Disadvantages of the indexes?
Does view occupy space?
Equi join and non equi join is possible with sql server?
What is subquery? Explain the properties of a subquery?