cursors

Dealing with periods and dates without using cursors

I would like to solve this issue avoiding to use cursors (FETCH). Here comes the problem... 1st Table/quantity ------------------ periodid periodstart periodend quantity 1 2010/10/01 2010/10/15 5 2st Table/sold items ----------------------- periodid periodstart periodend solditems 14343 2010/10/05 2010/10/06 2 Now...

Inconsistent cursor results when looping over databases

I have several databases named very similar (my-db-1, my-db-2, my-db-3, my-db-4). I want to execute the same stored procedure on each of these databases. I decided to use cursors. However, I am getting some strange issues. First here is my simple code that I am executing through SQL Server Management Studio 2008. DECLARE @db_cursor CUR...