第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

SQL Output子句是否可能返回未插入的列?

SQL Output子句是否可能返回未插入的列?

我已經(jīng)對(duì)數(shù)據(jù)庫(kù)進(jìn)行了一些修改,并且需要將舊數(shù)據(jù)遷移到新表中。為此,我需要填充一個(gè)表(ReportOptions),該表從原始表(Practice)中獲取數(shù)據(jù),并填充第二個(gè)中間表(PracticeReportOption)。ReportOption (ReportOptionId int PK, field1, field2...)Practice (PracticeId int PK, field1, field2...)PracticeReportOption (PracticeReportOptionId int PK, PracticeId int FK, ReportOptionId int FK, field1, field2...)我進(jìn)行了查詢,以獲取從“練習(xí)”移至“報(bào)告選項(xiàng)”所需的所有數(shù)據(jù),但是我無(wú)法填寫(xiě)中間表--Auxiliary tablesDECLARE @ReportOption TABLE (PracticeId int /*This field is not on the actual ReportOption table*/, field1, field2...)DECLARE @PracticeReportOption TABLE (PracticeId int, ReportOptionId int, field1, field2)--First I get all the data I need to moveINSERT INTO @ReportOptionSELECT P.practiceId, field1, field2...  FROM Practice P--I insert it into the new table, but somehow I need to have the repation PracticeId / ReportOptionIdINSERT INTO ReportOption (field1, field2...)OUTPUT @ReportOption.PracticeId, --> this is the field I don't know how to get       inserted.ReportOptionId  INTO @PracticeReportOption (PracticeId, ReportOptionId)SELECT field1, field2  FROM @ReportOption--This would insert the relationship, If I knew how to get it!INSERT INTO @PracticeReportOption (PracticeId, ReportOptionId)SELECT PracticeId, ReportOptionId  FROM @ReportOption如果我可以在OUTPUT子句上引用不在目標(biāo)表上的字段,那將很棒(我認(rèn)為我不能,但是我不確定)。關(guān)于如何滿足我的需求的任何想法?
查看完整描述

3 回答

  • 3 回答
  • 0 關(guān)注
  • 470 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)