如何從 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章