0
SQL Server 2008的更新/交換多個領域,約1萬行的dbo.VDATA
SQL服務器:在多個表
表dbo.VDATA
PARTNO UDL3 ........
'100 - TXT' '31OZ'
'101 - TXT' '32 OZ'
表dbo.VDAT_AUX
PARTNOAUX UDL12 ........
'100 - TXT' ''
'101 - TXT' ''
我需要完成:
SELECT *
FROM dbo.VDATA
WHERE (PARTNO LIKE '% - TXT')
for each row in dbo.VDATA
set @Var_PARTNO-TEMP = PARTNO
set PARTNO = UDL3 & ' - TXT'
##Add ' - TXT' and set as PARTNO value
set dbo.VDAT_AUX.UDL12 = (REPLACE @Var_PARTNO-TEMP, ' - TXT', '')
##Remove ' - TXT' and set as UDL12 value
set dbo.VDAT_AUX.PARTNOAUX = dbo.VDATA.PARTNO
01期望的結果的
例子:
表dbo.VDATA
PARTNO UDL3 ........
'31OZ - TXT' '31OZ'
'32 OZ - TXT' '32 OZ'
表dbo.VDAT_AUX
PARTNOAUX UDL12 ........
'31OZ - TXT' '100'
'32 OZ - TXT' '101'
我能選擇我想要的行,但我敢失去了對如何加強通過和洗牌數據我需要它...任何幫助/建議將不勝感激,提前謝謝! :)