Well on production server I'd write some table valued function for splitting lists, but if you need quick ad-hoc query, this xml trick could workdeclare @listOfPageIds varchar(50), @data xmldeclare @temp table(id int)select @listofPageIds = '2, 3, 4, 5, 6, 7, 14, 15';select @data = '<t>' + replace(@listofPageIds, ', ', '</t><t>') + '</t>'insert into @tempselect t.c.value('.', 'int') as idfrom @data.nodes('t') as t(c)select * from @tempsql 小提琴演示 这篇关于在 SQL Server 中将 varchar 列表转换为 int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-31 19:19