Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 在';之后获取值';_Sql_Sql Server - Fatal编程技术网

Sql 在';之后获取值';

Sql 在';之后获取值';,sql,sql-server,Sql,Sql Server,我有一个这样的专栏: log --- smart.pc mobile.my.phone laptop.student.school dog.house pc.game.headset 我只想取“.”之后的最后一个值: log --- pc phone school house headset 我尝试使用case-when-log-like%.%来获取值,但在replace中,我不知道将什么放在旧值的位置来获取列中的所有值替换(日志,'','') 似乎它在这里也给出了答案:也许最简单的方法是使

我有一个这样的专栏:

log
---
smart.pc
mobile.my.phone
laptop.student.school
dog.house
pc.game.headset
我只想取“.”之后的最后一个值:

log
---
pc
phone
school
house
headset
我尝试使用
case-when-log-like%.%
来获取值,但在replace中,我不知道将什么放在旧值的位置来获取列中的所有值<代码>替换(日志,'','')


似乎它在这里也给出了答案:

也许最简单的方法是使用
string\u split()


是一把D小提琴。

所以最后一次
?@Charlieface之后的一切都是正确的
select s.value
from t cross apply
     string_split(t.log, '.') s
where t.log like '%.' + s.value;