adspace


How to transfer data from a cursor to variables with a "fetch" statement?

Answer Posted / Anand Kumar Jha

"To transfer data from a cursor to variables using the FETCH statement in MS SQL Server, you can use the DECLARE, OPEN, and FETCH statements. Here's an example:nnDECLARE @var1 INT;nDECLARE @var2 VARCHAR(50);nDECLARE myCursor CURSOR FOR SELECT col1, col2 FROM table_name;nOPEN myCursor;nFETCH NEXT FROM myCursor INTO @var1, @var2;..."

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the properties of the transaction?

1073


What is a coalesce function?

1283


How to rebuild the master database?

1166


What are the risks of storing a hibernate-managed object in a cache? How do you overcome the problems?

1197


List the ways in which dynamic sql can be executed?

1086


What is acid mean in sql server?

1245


Disadvantages of the indexes?

1223


What is normalization and what are the advantages of it?

1055


Can one drop a column from a table?

1089


Does view occupy space?

1019


Explain system functions or built-in functions? What are different types of system functions?

1065


What are different types of constraints?

1001


What is standby servers? Explain types of standby servers.

1079


Why we use the openxml clause?

1079


If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?

1047