Hello, I'm using sp_cursorprepexec. If I execute a query on query analizer it take 10ms to execute, but when I execute the same query with sp_cursorprepexec it take 600000 seconds. The table has 1000000 rows, and I seek only one by a key on index what is the diference Thanks
Can you post the query used here. SP_CURSORPREPEXEC is used to prepare and open a parameterized cursor statement. This command combines the functions of the sp_cursorprepare and sp_cursorexecute procedures. Here's an MSDN article on API Server Cursors. I guess the sp_cursor functions are used when the API cursor attributes or properties are not set to their default settings. When set to the default settings, they bring back the entire result set. When changed from the default settings, it uses these api server cursors, which only bring back 1 row at a time. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_con_07_7xpv.asp for your reference. Satya SKJ Contributing Editor & Forums Moderator http://www.SQL-Server-Performance.Com This posting is provided “AS IS†with no rights for the sake of knowledge sharing.