what is a cursor and what is its use?
Answers were Sorted based on User's Feedback
Answer / praveen singh
A cursor is a set of rows together with a pointer that
identifies a current row.
In other word, Cursor is a database object used by
applications to manipulate data in a set on a row-by-row
basis, its like recordset in the ASP and visual basic.
DECLARE @fName varchar(50), @lName varchar(50)
DECLARE cursorName CURSOR -- Declare cursor
LOCAL SCROLL STATIC
FOR
Select firstName, lastName FROM myTable
OPEN cursorName -- open the cursor
FETCH NEXT FROM cursorName
INTO @fName, @lName
PRINT @fName + ' ' + @lName -- print the name
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM cursorName
INTO @fName, @lName
PRINT @fName + ' ' + @lName -- print the name
END
CLOSE cursorName -- close the cursor
DEALLOCATE cursorName -- Deallocate the cursor
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / ramesh
when we execute any query its return result set. directly
to work on result set we use cursors.
but right now no one is supporting cursors.
| Is This Answer Correct ? | 3 Yes | 0 No |
how to generate XML out of QUERY?
Explain use of expression builder.
which one will take 1st priority in case of insert statement and select statement???
How to find Duplicate Records In table?
Can you move the resources after pausing the node? : sql server database administration
what is a transaction and what are acid properties? : Sql server database administration
What is the difference between 2-Tier architecture and 3-Tier architecture
15 Answers CTS, MCN Solutions, Oracle,
In the below query i have performed the commit transaction statement but still the values after the save are not saved. Can you please let me know why are the statements after save are rolled back even after commiting the data. help me with the understanding declare @trans2 varchar(10)='transaction2' begin transaction @trans2 insert into emp values(100,'xy',600); save transaction @trans2 insert into emp values(200,'pq',700); insert into emp values(300,'pq',800); commit transaction @trans2 rollback tran @trans2
You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?
Why we need to use secondry database file? though, we can do same work using primary database file also.
As a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this?
What is a cube? : sql server analysis services, ssas
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)