Forum Replies Created

Viewing 15 posts - 6,511 through 6,525 (of 7,600 total)

  • RE: Finding the most recently modified row from a group of tables

    SELECT IP.IPCode, MAX(AllSubtables.UpdateDate) AS LastUpdateDate

    FROM SAMPLE.IP IP

    INNER JOIN (

    SELECT IPCode, MAX(UpdateDate) AS UpdateDate FROM SAMPLE.IP IP2 GROUP BY IP2.IPCode

    UNION ALL

    SELECT IPCode, MAX(UpdateDate) AS UpdateDate FROM SAMPLE.AddressProfile AP GROUP BY AP.IPCode

    UNION...

  • RE: Check series is valid or not

    SELECT CASE WHEN Total_Rows = Active_Rows THEN 'Valid' ELSE 'Invalid' END AS Status

    FROM (

    SELECT

    SUM(1) AS Total_Rows,

    ...

  • RE: GetDate() 5 Years ago without time formated 'YYYY-MM-DD'

    Welsh Corgi (6/24/2013)


    Thanks for the help guys.

    I'm using the Data calculation in the WHERE Clause.

    WHERE Effective_Date < CONVERT(DATE, DateAdd(yy, - 5, GetDate()));

    Does it matter which method I use as far...

  • RE: Red lines under third occurance of a table name

    Sean Pearce (7/11/2013)


    ScottPletcher (7/11/2013)


    Sean Pearce (7/11/2013)


    bert.hooks (7/11/2013)


    Wow. Insults from an idiotic know-it-all.

    Pot --> kettle --> black.

    Excuse me for being defensive, but Microsoft products have been putting food on...

  • RE: linked server issue

    PearlJammer1 (7/11/2013)


    Scot - your suggestion worked. I had to enable the MSDTC service and now the distributed queries run.

    Thanks for the pointer !

    🙂

    No problem. That's the most common fix,...

  • RE: Red lines under third occurance of a table name

    Sean Pearce (7/11/2013)


    bert.hooks (7/11/2013)


    Wow. Insults from an idiotic know-it-all.

    Pot --> kettle --> black.

    Excuse me for being defensive, but Microsoft products have been putting food on my table since...

  • RE: Red lines under third occurance of a table name

    You could also just add a "GO" after the ALTER TABLE; that will put the SELECTs in a separate batch, by which table SQL should "know" they already exist, having...

  • RE: Tempdb issue

    After you issue the command(s) below, the next time SQL starts, tempdb will be sized accordingly.

    Split the 2GB into equal parts, for however many tempdb data files you have.

    For this...

  • RE: linked server issue

    First verify that DTC (Distributed Transaction Coordinator) is up and running properly on both(/all) instances.

  • RE: Red lines under third occurance of a table name

    I think SQL parses things a batch at a time. All your code is in the same batch, and the table is created in that batch. That might...

  • RE: Check if Function EXISTS before adding

    It's a kludge, but when I really needed it, I simply change the db context to tempdb if the function already exists in the main db, then delete the function...

  • RE: Implicit conversion using COALESCE or CASE

    ISNULL() has its own oddities:

    DECLARE @var1 char(1)

    SET @var1 = NULL

    SELECT ISNULL(@var1, 'N/A') -- Result = 'N'

  • RE: Implicit conversion using COALESCE or CASE

    I'd suggest using COALESCE also, keeping in mind the difference between it and ISNULL in regard to data types.

    Given that, in this case you could explicitly CAST the 99 to...

  • RE: substring comparison for last 2 characters

    SELECT

    mt.##col1##, ..., jt.##co11##, ...

    FROM dbo.maintable mt

    LEFT OUTER JOIN jointable jt ON

    --ignore last two bytes of patid if they are alpha, because it's...

  • RE: Delete data and Transaction Logs

    IIRC, partitioned views are allowed in Standard Edition (at least as long as you don't try to update using a distributed partitioned view?).

    As I noted first, a truly partitioned table...

Viewing 15 posts - 6,511 through 6,525 (of 7,600 total)