Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vin
Starting Member
26 Posts |
Posted - 2003-05-16 : 07:54:22
|
| Hi,In sql server 2000 is it not possible to return a cursor as a resultset. |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-05-16 : 08:00:24
|
| cursor/resultset .... apples/oranges ...What business rule are you trying to fulfill and what method are you trying to use to do it?Jay White{0} |
 |
|
|
vin
Starting Member
26 Posts |
Posted - 2003-05-16 : 08:19:55
|
| Hi White,Suppose i hava a emp table, i need to select multiple records based on some condition, say sal>1000. How can i return the result set (ie is the multiple records). Can i return in as cursor. The returned records has to be processed by some other application. |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-05-16 : 08:22:13
|
create proc emp_with_sal_more_than_one_largeasselect emp_datafrom emp_tablewhere sal > 1000go Jay White{0} |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-05-16 : 09:19:56
|
| SQL returns results as a "recordset" of rows/columns using stored procedures or sql statements.in your application, you use ADO to execute that sql statement or stored procedure, and what is returned back is a cursor to the results. You then use that cursor to process the rows in your application.i.e.,dim r as recordsetset r = connection.execute "some sql here"r.movefirst' Now r is basically a cursordo while not r.eofdo somethingdo something elser.movenext ' move the cursor to the next row in the resultsloopdoes that clear things up a little? you only declare a cursor in SQL if you need SQL Server to process 1 row at a time in a result set, which you almost never need to do since SQL deals very efficiently with SETS of rows all at once.- Jeff |
 |
|
|
vin
Starting Member
26 Posts |
Posted - 2003-05-17 : 02:09:20
|
| Thanx Jeff...It is clear now |
 |
|
|
|
|
|