DECLARE @cts As DECIMAL
DECLARE @rcount As DECIMAL
SET @cts = 1
SELECT DISTINCT IDENTITY(INT,1,1) AS sno, *
INTO #temp1
FROM TABLE1
SELECT @rcount = Count(*) FROM #temp1
WHILE (@cts <= @rcount) Begin
SELECT @Times = Count(*) FROM #temp1 Where sno = @cts
SET @cts = @cts + 1
END
DROP TABLE #temp1
-----------------------------------------------------
DECLARE @TEMP TABLE
(
ID int IDENTITY PRIMARY KEY,
seqno nvarchar(50),
number nvarchar(50),
)
Declare @cts As Decimal
Declare @rcount As Decimal
Set @cts = 1
insert into @TEMP
Select seqno, number
From cntmgm.dbo.CNTCMSD_TAB
Select @rcount = Count(*) From @TEMP
While (@cts <= @rcount) Begin
Select @ResultVar = number + '|' + plandate + '|' + projectno
From @TEMP
Where ID = @cts
Set @cts = @cts + 1
End
沒有留言:
張貼留言