sql获取第一个字符,修剪到句点,然后是剩余字符
我有一列名称,我需要选择第一个字符,直到一个句点,然后获得剩余的字符 范例 所需输出的源列名sql获取第一个字符,修剪到句点,然后是剩余字符,sql,tsql,Sql,Tsql,我有一列名称,我需要选择第一个字符,直到一个句点,然后获得剩余的字符 范例 所需输出的源列名 bob.smith bsmith mary.alice malice bill.gates bgates CHARINDEX将允许您搜索时段的位置,然后您可以使用子字符串返回所需的数据 样本数据 CREATE TABLE #TempData (FieldName varcha
bob.smith bsmith
mary.alice malice
bill.gates bgates
CHARINDEX
将允许您搜索时段的位置,然后您可以使用子字符串
返回所需的数据
样本数据
CREATE TABLE #TempData (FieldName varchar(10))
INSERT INTO #TempData (FieldName)
VALUES
('bob.smith')
,('mary.alice')
,('bill.gates')
质疑
结果
FieldName Result
bob.smith bsmith
mary.alice malice
bill.gates bgates
FieldName Result
bob.smith bsmith
mary.alice malice
bill.gates bgates