I’m not sure where to post the code, I don’t want to make anyone irritated, but I need legit help with my SQL. Is this the right place? If not, what is the right community?

    • newbeni@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I didn’t know which post to reply to, so here goes: with one as (select top 1 field1, replace(field2_html,‘’‘"]|([‘’"]).?\1)*>’, ‘’) as comments_html, field3, field4, field5, field6, field7, field8 from tablea where comments_html !=’ '),

      two as (select field1, field2 as html_clean, charindex(‘<’,field2_html) as a, charindex(‘>’,field2_html) as b, field3, field4, field5, fied6, field7, field8
      from one)

      select * into #temp8 from two

      create table #RUdestinationtable (field1 int, comments_2 varchar(max), field3 varchar(300), field4 varchar(50), field5 varchar(300), field6 varchar(300), field7 varchar(300), field8 varchar(150))

      while (select count(1) from #temp8 where substring(html_clean,a,b) is not null)>0 begin insert into #RUdestinationtable select distinct field1,replace(html_clean, substring(html_clean,a,b),‘’) as comments_2,field3, field4, field5, field6, field7, field8 from #temp8 end

      select * fromRUdestinationtable

  • WontonSoup@lemmy.ml
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    1 year ago

    Ask away but we’re likely going to need to see the table structure unless it’s really generic

    Edit: forgot a

  • jtk@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    This usually fixes everything for me. Make sure to send the value through a parameter of a stored procedure that concatenates strings to build a query, any one will do:

    Robert’); DROP TABLE Homework;–