OrganizationIds 1、2 を @String 変数に保存しました。それを Integer に変換したいのですが、誰か助けてください。
以下は私のコードです..
DECLARE @RowCount INT
Declare @String varchar(100)
declare @OrganizationIds int
SELECT @RowCount = COUNT(*) FROM @RawData
WHILE (@RowCount>0)
BEGIN
set @String=convert(varchar,@OrganizationIds)+','
If (@RowCount>0)
Begin
PRINT 'Loop Sequence : ' + convert(varchar,@RowCount) + ' '
set @OrganizationIds = (SELECT OrgId FROM @RawData WHERE ROWID = @RowCount)
PRINT 'Orgid Inside Loop:' + Convert(varchar,@OrganizationIds)
End
Set @RowCount = @RowCount-1
Set @OrganizationIds = convert(varchar,@OrganizationIds)
PRINT 'Orgid Outside Loop:'+ convert(varchar,@OrganizationIds)
set @String=@String + Convert(varchar,@OrganizationIds)
END
PRINT 'String Value Outside Loop: ' + @String
Declare @TempData Table
(
OrganizationID int
)
insert into @TempData(OrganizationID)
EXEC GetFormsData_Organization @String