2 of 5 added 766 characters in body

declaring cursor to loop over some values in SQL server 2008 R2

I am just new to sql and exploring google from last few days but unable to get the answers of my Query Can anyone help me with

EDIT: Information I have some business unit such as India, International, US, UK

Now i have to: Create a table variable (virtual in-memory table) with columns that match SPROC SP_Report resultset. (Which i have done).

Now, I have to declare a cursor that contains all business units and then the cursor should loop over the BU's. For each BU, what i have to do is : 1)Execute SPROC, SP_Report and insert the data into the table variable. ( I did this too, but i dont know how and when to use it in Cursor.)

2) Then i have to select the columns from the table variable + timestamp + BU and insert them into the another table.

o Finally have to clear the table variable

Code: ` Declare @K table(BU nvarchar(max), K nvarchar(max),Y money, A money, D money, YP money ) Declare @FY int Declare @BU nvarchar(max)

insert into @K(BU,K,Y,A,D,YP) exec [dbo].SP_Report '2012', 'India'

SELECT * FROM @K `

This code gives me the result of the table variable.

Now i have to use it cursor, which i don't know how to. How I can solve the same.