Monday, September 16, 2013

SQL Cursor example

Here is example for SQL  CURSOR  in  SQL SERVER

 

declare @datefrom datetime,

@dateto datetime ,

@Datevar datetime

select @datefrom=MIN(ActiveDate),@dateto=MAX(ActiveDate)  from #tmpClients

 

 

DECLARE delete1monthclient_cursor CURSOR FOR

select cdate from PB_GetAllDays(@datefrom,@dateto)

 

OPEN delete1monthclient_cursor

 

FETCH NEXT FROM delete1monthclient_cursor

INTO @Datevar

WHILE @@FETCH_STATUS = 0

BEGIN

 

//--Code here ---

select @Datevar

 

 

FETCH NEXT FROM delete1monthclient_cursor

INTO @Datevar

End

 

CLOSE delete1monthclient_cursor;

DEALLOCATE delete1monthclient_cursor;


If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

0 comments:

Post a Comment