如何从 SQL Server 中的值列表中进行选择 - How can I select from list of values in SQL Server

问题:

I have very simple problem that I can't solve.我有一个非常简单的问题,我无法解决。 I need to do something like this:我需要做这样的事情:

select distinct * from (1, 1, 1, 2, 5, 1, 6).

Anybody can help??有人可以帮忙吗??

Edit编辑

The data comes as a text file from one of our clients.数据来自我们的一位客户的文本文件。 It's totally unformatted (it's a single, very long line of text), but it may be possible to do so in Excel.它完全没有格式化(它是一行很长的文本),但在 Excel 中可能会这样做。 But it's not practical for me, because I will need to use these values in my sql query.但这对我来说并不实用,因为我需要在我的 sql 查询中使用这些值。 It's not convenient to do so every time I need to run a query.每次需要运行查询时都这样做很不方便。


解决方案:

参考一: https://stackoom.com/question/6Z7E
参考二: How can I select from list of values in SQL Server
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章