#object
ある列で一時テーブルを作成するクエリがあり、別のクエリ結果の列で(id int)
拡張したいと考えています。#object
カーソルを使用してみました:
CREATE TABLE #object(ID int)
DECLARE @q int
DECLARE @getid CURSOR
SET @getid= CURSOR FOR
select Q.Question /*, QR.ResponseText, QR.DynamicQuestionResponseID*/ from DynamicForms_Question as Q
inner join DynamicForms_QuestionResponse as QR on Q.DynamicQuestionID = QR.DynamicQuestionID
where Q.ModuleID = 729
and QR.ResponseDateTime = '2012-12-27 11:31:00'
and QuestionType <> 'Label'
and QuestionType <> 'HR'
order by Q.SortOrder asc
OPEN @getid
FETCH NEXT
FROM @getid INTO @q
WHILE @@FETCH_STATUS = 0
BEGIN
Alter Table #object add -- what can i use here????
FETCH NEXT
FROM @getid INTO @q
END
CLOSE @getid
DEALLOCATE @getid
drop table #object