SQL Server 2008,约 100 万行dbo.VDATA
桌子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
期望结果的示例:
桌子dbo.VDATA
PARTNO UDL3 ........
'31OZ - TXT' '31OZ'
'32 OZ - TXT' '32 OZ'
桌子dbo.VDAT_AUX
PARTNOAUX UDL12 ........
'31OZ - TXT' '100'
'32 OZ - TXT' '101'
我可以选择我想要的行,但我对如何逐步浏览和随机播放我需要的数据非常迷茫......任何帮助/建议将不胜感激,在此先感谢您!:)