我有一个包含文件名的列,我需要提取文件名的一部分
示例:
2015419
2015418
2015416
2015415
所以结果集应该是
_
日期发生将始终发生在/**
* The maximum size of array to allocate.
* Some VMs reserve some header words in an array.
* Attempts to allocate larger arrays may result in
* OutOfMemoryError: Requested array size exceeds VM limit
*/
private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
4之后。
任何指针都非常受欢迎。
答案 0 :(得分:1)
以下是使用=IF(A1=A2, INDEX(A1:E6, 1, 5), "Nothing found")
和Cross Apply
字符串函数
<强>演示强>
Charindex
<强>结果强>
;WITH cte
AS (SELECT *
FROM (VALUES ('abc_sfrs1_sdfre_fdsj_2015419_154825.jpeg'),
('asdac_cfwes_ssaare_fdsj_2015418_52584.jpeg'),
('ezxc_afrs_hdeas_fdsj_2015416_15484.jpeg'),
('rer_bfee_rre_fdsj_2015415_25485.jpeg')) tc (string))
SELECT EXTRACTED_DATA = Substring(string, fur + 1, fiv - fur - 1)
FROM cte
CROSS apply (VALUES (Charindex('_', string))) cs (fst)
CROSS apply (VALUES (Charindex('_', string, fst + 1))) cs1 (scd)
CROSS apply (VALUES (Charindex('_', string, scd + 1))) cs2 (thd)
CROSS apply (VALUES (Charindex('_', string, thd + 1))) cs4 (fur)
CROSS apply (VALUES (Charindex('_', string, fur + 1))) cs5 (fiv)
<强>更新强>
对于你的桌子,它应该是这样的
EXTRACTED_DATA
--------------
2015419
2015418
2015416
2015415