Forum Replies Created

Viewing 15 posts - 1,156 through 1,170 (of 3,544 total)

  • RE: Selecting first value that meets specific range across numerous columns

    Depending on how and where the data is retrieved you could use sql CASE statement, ie

    UPDATE ...

    SET col15 = CASE

    WHEN col2 >= 'V000' AND col2 < 'Y99 ' THEN col2

    WHEN...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Updating Records Based on Select Results

    Or for /* updating parents if no lower ranked scouts exist */

    UPDATE g

    SET PG_STATUS='INACTIVE'

    FROM [PARENT_GUARDIAN_TEMP] g

    JOIN (SELECT g.PG_ID

    FROM [PARENT_GUARDIAN_TEMP] g

    JOIN [xref_PG_SCT_TEMP] x ON x.PG_ID=g.PG_ID

    JOIN...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Searching a column for a word

    Try this

    LIKE '%rate[!"'',.:;? ]%'

    You can add additional chars between [] but check LIKE and PATINDEX on BOL (Books Online) for special chars and how to ESCAPE them.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Searching a column for a word

    toddasd (3/17/2011)


    Does SS just ignore the spaces when comparing '% rate %' to 'rate'?

    No the spaces are important. You wanted to find particular words ie rate and words are separated...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Split Comma Seperate Column Problem

    Koen Verbeeck (3/17/2011)


    Jeff, stop interfering in SSIS threads. 😛 😀

    Ahhh!!! Be nice to Jeff, he can't help it if he is stuck in a T-SQL sandbox and can't come out...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Searching a column for a word

    WHERE CHARINDEX(' rate ', ' '+col+' ') > 0

    or

    WHERE ' '+col+' ' LIKE '% rate %'

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Varchar to datetime

    sqlserver12345 (3/15/2011)


    Does not work.....

    Msg 241, Level 16, State 1, Line 1

    Conversion failed when converting datetime from character string.

    Date conversion is also dictated by the language setting of the login as...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: String

    Using DelimitedSplit8K code and a Tally table

    WITH split (ItemNumber,Item) AS (

    SELECT ROW_NUMBER() OVER (ORDER BY t.N) AS [ItemNumber],

    SUBSTRING(tbl.[Text], t.N, CHARINDEX(' ',...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: INSERT OUTPUT INTO (With an extra column) and SELECT statement

    My suggestion would be to create a temp table (including a TempID identity column) of all the data to be inserted/used from TableC

    Insert into TableA from this temp table but...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SUBSTRING Question?

    Also check that mdmpa.message_text does not have non space chars following "ALL MET ITEMS FOR VIN PROCESSED SUCCESSFULLY"

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SUBSTRING Question?

    I think the issue is on "SUBSTRING(bd.buft_string_1, 35, 70) = mdmpa.message_text"

    Did you prove this by removing the join and getting rows returned?

    If it is the substring then the most likely...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: query data from multiple linked servers

    TK-42-1 (3/11/2011)


    That worked and actually solved another problem I was having with some of the notification side of it.

    Thank you.

    You're welcome and thank you for the reply 🙂

    And remember there...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: query data from multiple linked servers

    Put

    BEGIN TRY

    END TRY

    BEGIN CATCH

    END CATCH

    around your exec

    e.g.

    BEGIN TRY

    EXEC (@query)

    END TRY

    BEGIN CATCH

    PRINT @net + ' Failed'

    END CATCH

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Condition in Where clause query

    Sorry my bad the inner CASE is missing END, try this

    AND CASE WHEN MG_BOOKING.TRADE_CD IS NULL THEN

    CASE WHEN BA.TRADE IN (select distinct Item From dbo.Split(@trades,',')) THEN 1 ELSE 0...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Condition in Where clause query

    pwalter83 (3/9/2011)


    Hi Gail and David,

    Thanks a lot for your answers but would it be possible to convert your solution in a way that they can be included in the WHERE...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 1,156 through 1,170 (of 3,544 total)