0
How to select only part of a table record?
Source data:
"brt_qsr01:NT"
and I intended it to return only qsr01
I’m doing so, but then I can’t remove the data on the left
SELECT left([coluna], CHARINDEX(':', [coluna]) -1 ) FROM [dbo].[tabela]
0
How to select only part of a table record?
Source data:
"brt_qsr01:NT"
and I intended it to return only qsr01
I’m doing so, but then I can’t remove the data on the left
SELECT left([coluna], CHARINDEX(':', [coluna]) -1 ) FROM [dbo].[tabela]
0
For this particular case, you could do so:
SELECT substring( nome_coluna, 5, 5 ) FROM tabela
But if the positions are different from record to record, you need to apply a smart rule. If so, post more information so we can help you.
0
Thanks for the tips
Solved the problem
DECLARE @teste varchar(100)
SET @teste = '"brt_qsr01:NT"'
select SUBSTRING(@teste,CHARINDEX('_',@teste)+1,CHARINDEX(':',@teste)-CHARINDEX('_',@teste)-1)
Returns only the string I want: qsr01
Browser other questions tagged sql-server
You are not signed in. Login or sign up in order to post.
A while ago I answered this: How to remove keywords between keys { } in the Mysql field? that looks a lot like what you want!
– Marconi
And what is the rule to remove the prefix, so that it is only
qsr01?– José Diz