Wayne Barron
asked on
TSQL Get Data between [ brackets ]
Hello all,
In SSMS, when you
When you click on a column, it will jump to the end of the text in that column.
Is there a way, to make it jump to the beginning of the column, instead of the end?
In SSMS, when you
Right Click "Edit All Rows"
When you click on a column, it will jump to the end of the text in that column.
Is there a way, to make it jump to the beginning of the column, instead of the end?
ASKER
Explanation of why I was asking.
I have several hundred records that I need to go through.
I am looking for the tag in each and every row.
So, I was going to just go through each record and update it manually.
I think a better way would be to run a query for everything between the brackets.
Return all rows, and then copy the data over to the new column.
Any ideas on this would be great.
I have several hundred records that I need to go through.
I am looking for the tag in each and every row.
[proimge=image.jpg]
I am then going to take that value, and place it in a new column for the image.So, I was going to just go through each record and update it manually.
I think a better way would be to run a query for everything between the brackets.
Return all rows, and then copy the data over to the new column.
Any ideas on this would be great.
Yes, an update query would be best. Please explain your steps in a bit more detail with screenshots
ASKER
I just found this and modified it, and it returns all records.
however, it cuts off some of the content.
Using the code above, the following happens.
This record
This record
However, this record.
So, it seems the code works, but does not give the correctly expected results.
NOW, keeping in mind.
The code has a LOT of BRACKETS in it.
however, it cuts off some of the content.
select EVID, evTitle, SUBSTRING(evFullContent,CHARINDEX('[proimg=',evFullContent)+1,CHARINDEX(']',evFullContent) - CHARINDEX('[',evFullContent)-1) from evContent
Using the code above, the following happens.
This record
[proimg=carrzkiss/carrzkiss_02-58-55-Jul-14-2012_carrzkiss_02-34-52-Jun-11-2011_EnterView_.png]EnterView - Connecting Entertainment and the views of the world together![/proimg]
Will return this valueproimg=carrzkiss/carrzkiss_02-58-
This record
[proimg=carrzkiss/carrzkiss_02-57-25-Jul-14-2012_carrzkiss_01-09-41-Mar-01-2011_logo.jpg]Carrz-Fox-Fire Promotions[/proimg]
Will return this valueproimg=carr
However, this record.
[proimg=carrzkiss/carrzkiss_02-57-26-Jul-14-2012_carrzkiss_07-04-59-Mar-23-2011_Logo.png]Dark Effects Productions[/proimg]
Will return this value (The correct value)proimg=carrzkiss/carrzkiss_02-57-26-Jul-14-2012_carrzkiss_07-04-59-Mar-23-2011_Logo.png
So, it seems the code works, but does not give the correctly expected results.
NOW, keeping in mind.
The code has a LOT of BRACKETS in it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Worked great.
Thank you very much.
Thank you very much.
You can try Heidi
https://www.heidisql.com/download.php