mercredi 18 mai 2016

Create cursor for temporary table in sql server 2005

I have some data inserted into the temporary table and I want to show COUNT in a LOOP by using CURSOR

Here is the temp table:-

SELECT * 
INTO #temp
 FROM (
select distinct a.CUser_id, b.User_Id, b.first_name + ' ' + b.last_name NAME
from inward_doc_tracking_trl a, user_mst b
where a.CUser_id = b.mkey
and CStatus_flag = 1
and NStatus_flag = 4
) AS x
Select * from #temp order by NAME

TEMP TABLE data

I am new to cursor, kindly help

I am using sql server 2005

Aucun commentaire:

Enregistrer un commentaire