我想在SQL Server上返回每個由斜槓分解的字符串的日期。從SQL Server的某些列中展開值的返回日期
我的數據庫表:
id | date | col1 | col2 | col3 | col4
---+------------+-------------+-----------+-------+------------
1 | 2017-04-02 | /txt1/txt2 | | |
2 | 2017-04-03 | | /txt1/txt4| |
3 | 2017-04-04 | |/txt2/txt3 | |
4 | 2017-04-05 | |/txt4 | |/txt5/txt6
結果想:
2017-04-02 txt1
2017-04-02 txt2
2017-04-03 txt1
2017-04-03 txt4
2017-04-04 txt2
2017-04-04 txt3
2017-04-05 txt4
2017-04-05 txt5
2017-04-05 txt6
謝謝 皮埃爾
那麼,你爲什麼不跟我們分享你到目前爲止試過嗎? –
閱讀[在數據庫列中存儲分隔列表真的不好嗎?](http://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-那麼你會看到很多原因,爲什麼這個問題的答案是**絕對是!** –
@ZoharPeled它可以是這種情況,但OP不負責數據庫的設計。 –