SQL code to update iframe properties

Hi Guys,

I would like to edit the iframe properties (<iframe width="" height=""></iframe>) of all the Youtube video links which are stored on my database in a table called "Product" in a field called "FullDescription". I want to change all my Youtube videos iframe properties from iframe width="640" height="360" to iframe width="830" height="400". I was thinking if I could run an sql code on my database to change the iframe properties of all the video links stored in the database? How can I do this? Please help.

I am using Microsoft SQL Server 2016.

is there any other text in the FullDescription column other than iframe width="640" height="360"

update tgt
  set tgt.FullDescription = replace(FullDescription, 'iframe width="640" height="360"', 'iframe width="830" height="400"')
from Product
where FullDescription like '%iframe width="640" height="360"%'

try it in test first

Create table #product(FullDescription varchar(150))

insert into #product
select 'iframe width="640" height="360"'
  from sys.columns
  where column_id between 1 and 12

  select * From #product

  update tgt
  set tgt.FullDescription = replace(FullDescription, 'iframe width="640" height="360"', 'iframe width="830" height="400"')
from #product tgt
where FullDescription like '%iframe width="640" height="360"%'

  select * From #product

  drop table #product
1 Like

Yes there is other text in the table and it actually worked. All I had to do was run:
UPDATE Product
SET FullDescription = REPLACE(FullDescription,'iframe width="640" height="360"','iframe width="830" height="400"')

Keep up the good work helping more amateurs like me. :slight_smile:

we all were amateurs at one time and still are in some aspects of life and technology.