sql - Using SubString when not knowing position or length -


Can someone help me as I need to remove the number after "code =" reference = "? It is not possible to know the number of characters before or after the number as well as the number of length (can also be letters and numbers), but it is always

"Reference =" first ", description"

object = CTSENORaanG, reference = 0000021357, description = test, currency = EUR, Initial_Date = 15Aug2011 ....

The string is from a table with a large amount of rows and I must include the reference of each row in another table

SQL Server

  declare @str varchar (1000) set @ Str = 'object = ctsnorang, reference = 0000021357, description = test, currency = EUR, Initial_Date = 15Aug2011 ....'; Select from substring (col, 1, charindex (',', col) -1) (select substring (@ str, charindex ('references =', @ str) +10,100);;   

MySQL

  set @str: = 'object = ctsnorang, reference = 0000021357, description = test, currency = EUR, Initial_Date = 15Aug2011 ....'; Substring (Col, 1) Select (from ',', cola) -1) (substring (@ str, find out ('reference =', @ str) +10,100);;    

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -