syntax for updatetext

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • First Tracks Research

    syntax for updatetext

    hello,

    i would like to update a column called footer in a table called
    agency. i have to update about 60 different records in this table.


    footer is varchar(200)

    i would like to search for "<table bgcolor="#ccccc c"" and replace it
    with "<table "

    there is stuff before and after the start of the table tag.

    i looked at the books online and could not get the syntax correct.

    am i using the right command? updatetext, or should i do this with a
    loop?

    thanks in advance.
    nicholas.gadacz
  • Shervin

    #2
    Re: syntax for updatetext

    Nicholas,

    This script will do what you want. Don't forget to add a WHERE clause to it
    if you want it to check only a portion of your table.

    update YourTable
    set footer = replace(footer, '<table bgcolor="#ccccc c"', '<table ')

    Shervin

    "First Tracks Research" <info@ftresearc h.com> wrote in message
    news:4d02a84e.0 309231654.766e8 bb6@posting.goo gle.com...[color=blue]
    > hello,
    >
    > i would like to update a column called footer in a table called
    > agency. i have to update about 60 different records in this table.
    >
    >
    > footer is varchar(200)
    >
    > i would like to search for "<table bgcolor="#ccccc c"" and replace it
    > with "<table "
    >
    > there is stuff before and after the start of the table tag.
    >
    > i looked at the books online and could not get the syntax correct.
    >
    > am i using the right command? updatetext, or should i do this with a
    > loop?
    >
    > thanks in advance.
    > nicholas.gadacz[/color]


    Comment

    • nick gadacz

      #3
      Re: syntax for updatetext



      what happens if the field is ntext? how does that change the process? do
      you have to use updatetext in dealing with that field type?

      thanks again.

      nicholas.gadacz

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Shervin

        #4
        Re: syntax for updatetext

        Yes, you must use UPDATETEXT on text, ntext and image data types. Take a
        look at the sample in SQL Server Books Online.

        Shervin


        "nick gadacz" <info@ftresearc h.com> wrote in message
        news:3f7114da$0 $62083$75868355 @news.frii.net. ..[color=blue]
        >
        >
        > what happens if the field is ntext? how does that change the process? do
        > you have to use updatetext in dealing with that field type?
        >
        > thanks again.
        >
        > nicholas.gadacz
        >
        > *** Sent via Developersdex http://www.developersdex.com ***
        > Don't just participate in USENET...get rewarded for it![/color]


        Comment

        Working...