Forum Replies Created

Viewing 15 posts - 46 through 60 (of 62 total)

  • RE: Update with select replace

    derek.colley (2/21/2012)


    Looks like @prereplace is set to 'code1=' when other dependent @vars are null, as you're concatenating variables and a string.

    So replace:

    update documentbody

    set bodytext = @myvar

    where @prereplace is not null

    with:

    update...

  • RE: reading html

    I'm trying to update the bodytext column of the documentbody table for rows where this string is found.

    <body><p><aname="productLink" class="productLink" code1="1463513" >ProductLink</a></p></body>

    with

    <body><p><aname="productLink" class="productLink" code1="1463513" ode2="4567891">ProductLink</a></p></body>

    the update statement below, updates every...

  • RE: reading html

    error

  • RE: reading html

    Thanks.

    I'll try to describe the problem in detail.

    Users are able to enter a product code (code1 and code2 as a pair) into a document. There may be more than one...

  • RE: reading html

    I wished a simple replace was the solution. I was far too simplistic in my initial post.

    I've figured out a few things to get me started.

    From this

    <body><p><a code1="111111" code2="222222"</a></p>

    </body>

    I...

  • RE: Deleting rows from multiple tables using join

    Ken McKelvey (4/7/2011)


    DELETE can only delete rows from one table so you will need to delete from each table in the correct order.

    Something like the following:

    DELETE docBodyVersion

    WHERE EXISTS

    (

    SELECT *

    FROM document...

  • RE: Insert into query

    RP_DBA (2/23/2011)


    How about if you moved the email criteria to the outer select and added a DISTINCT?

    insert into userprofile(userID, fieldID, value,)

    select distinct userID, 1000, 'external'

    from user

    where not exists...

  • RE: Insert into query

    I tried this...

    if exists(select email from user where

    email LIKE '%@hotmail%' or

    email LIKE '%@gmail%' or

    email LIKE '%@googlemail%' or

    email LIKE '%@yahoo%')

    insert into userprofile(userID, fieldID, value, primaryVal, levelID)

    select userID, 5001,...

  • RE: Insert into query

    RP_DBA (2/23/2011)


    Not sure if this'll work or not (base table script and sample data would be helpful) but try adding userID and another set of parenthesis around the ORs in...

  • RE: where not in

    That was a typo; thanks for catching that!

  • RE: where not in

    Thanks; that worked!

  • RE: Deleting tables from master database

    Lowell (9/24/2010)


    each drop table statement has to be execute seperately, no wildcards, but you can generate all the necessary statements from the metadata:

    then you can copy/paste the commands and run...

  • RE: attemting to create a date range from unix-style dates

    Lowell (9/23/2010)


    i think it's just syntax: the query in the parenthesis needs an alias, and you select from THAT:

    select month(dateadd(s,creationDate/1000,'1970-01-01')) as mnth, year(dateadd(s,creationdate/1000,'1970-01-01')) as yr

    FROM

    (

    ...

  • RE: Replacing substring with a substring

    I have resolved this with the following statement

    update bodyTextTable

    set bodyText = cast(replace(cast(bodyText as nvarchar(max)),'/themes/old/', '/themes/new/') as ntext)

    I had to cast ntext to nvarchar and cast it back to ntext after...

  • RE: Replacing substring with a substring

    Steve Jones - Editor (9/15/2010)


    Use a SELECT to debug this

    SELECT bodytext

    , replace (bodyText, '%/themes/old/%', '%/themes/new%')

    from bodyTextTable

    Your select statement returns

    Msg 8116, Level 16, State 1, Line...

Viewing 15 posts - 46 through 60 (of 62 total)