我有这样的情况(T-SQL):
表 1:dbo.Printers
EmulationID EmulationDescription PrinterID Name
34,15,2 NULL 12 HP 1234
15,2 NULL 13 IBM 321
15 NULL 14 XYZ
表 2:dbo.Emulations
EmulationID Description
34 HP
15 IBM
2 Dell
dbo.Printers 表中的 EmulationID 列是 nvarchar/unicode 字符串数据类型,而 dbo.Emulations 表中的整数数据类型。
现在我必须通过 EmulationID 列在 dbo.Emulations 表上查找来更新dbo.Printers 表中的**EmulationDescription**列。
我需要在 dbo.Printers 表中获取这样的数据:
EmulationID EmulationDescription PrinterID Name
34,15,2 HP,IBM,Dell 12 HP 1234
15,2 IBM,Dell 13 IBM 321
15 IBM 14 XYZ
有人可以详细帮助我,如何解决这个问题吗?
我创建了用户定义函数 dbo.ParseIdListToTable 将一行中的字符串数据转换为多行。但是,我不知道要进一步了解如何准确加入然后更新。
任何建议将不胜感激。