【急】循环插入INSERT,有个ID是自定义的
declare @ReturnID int
@ReturnID 值是从一个表查询出最大ID然后加一
INSERT INTO #TB_ReportField(ReportTicketID ,OrderNo,OrderName)
select @ReturnID as ReportTicketID,
OrderNo,OrderName
from #TmpReportData
CREATE TABLE #TB_ReportField
(ReportTicketID INT IDENTITY(1,1)?,
OrderNo VARCHAR(10),
OrderName VARCHAR(10))
?INSERT?INTO??#TB_ReportField(OrderNo,OrderName)
select?OrderNo,OrderName
from?#TmpReportData??