/****** Script for SelectTopNRows command from SSMS ******/
SELECT [Id] AS [SeatId]
-- ignore seatId from the oringal table- it's not the true id, it's like a title
FROM [pointsebagothisticketcomdb]。[dbo]。[tb_Seat] WHERE [sectionID] = 1 AND [RowId] ='C'
- 对于每个id to THIS
INSERT INTO [pointsebagothisticketcomdb].[dbo].[tb_Ticket]
([showTimeId]
,[SeatId]
,[Price]
-- ,[notes] IGNORE [NOTES] I PLAN TO REMOVE IT FROM SCHEMA TODAY
,[reservedTime]
,[Identifier]
,[CreatedOn]
,[CreatedBy]
,[ModifiedOn]
,[ModifiedBy]
,[IsDeleted]
,[IsSold])
VALUES
(<showTimeId, int,> -- @showTimeId
,<SeatId, int,> -- THIS IS THE alias SeatId (really [dbo].[tb_Seat].Id)
,<Price, decimal(10,2),> -- @price
--,<notes, ntext,> IGNORE [NOTES] I PLAN TO REMOVE IT FROM SCHEMA TODAY
,<reservedTime, datetime,> -- @reservedTime
,<Identifier, uniqueidentifier,> -- AUTOMATICALLY ASSIGNED BY THE DB AS NEWGUID
,<CreatedOn, datetime,> -- AUTOMATICALLY ASSIGNED = CURRENT UTC DATE TIME
,<CreatedBy, nvarchar(50),> -- SET = @CreatedBy
,<ModifiedOn, datetime,> -- AUTOMATICALLY ASSIGNED = CURRENT UTC DATE TIME
,<ModifiedBy, nvarchar(50),> -- SET = @CreatedBy
,<IsDeleted, bit,> -- SET = 0
,<IsSold, bit,>) -- SET = 0
GO
从第一个询问我得到的行数让我们想要二十行现在我想根据这些行进行插入SEATID 我如何根据它来录制所有录音呢?
答案 0 :(得分:4)
INSERT INTO [pointsebagothisticketcomdb].[dbo].[tb_Ticket]
([SeatId])
SELECT [Id] AS [SeatId]
FROM [pointsebagothisticketcomdb].[dbo].[tb_Seat]
where [sectionID] = 1 AND [RowId] = 'C'`