0

我正在使用 SQL Server 2008 和 C# ADO.NET 来完成此任务。

我想使用存储过程将这些数据插入到表中SAVEDATA

谢谢

斯罗什

4

2 回答 2

1

好吧,您只需编写一条INSERT语句,然后从该表中选择传入的数据:

CREATE PROCEDURE [dbo].[spSave] (@theDATA As [dbo].[TVP] Readonly)
AS
BEGIN      
    INSERT INTO dbo.SaveResponse(ID, myQuestion, PersonWhoResponses,
                                 Response, [User], [DateTime])

       SELECT 
          ID, myQuestion, PersonWhoResponses,
          Response, [User], [DateTime]
       FROM
          @theDATA
END
于 2012-07-25T13:51:11.927 回答
0
INSERT INTO @theData ( 
  SELECT [ID], [myQuestion], [PersonWhoResponses], [Response] , [User],  [DateTime]
  FROM SAVERESPONSE
  WHERE ...
)
于 2012-07-25T13:50:51.773 回答