Forum Replies Created

Viewing 15 posts - 2,446 through 2,460 (of 3,544 total)

  • RE: How to find NOT TOP 3? (Next rows after row 3)

    One way is put the results into a temp table first with an IDENTITY column and then select based on the value of the IDENTITY column.

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

  • RE: SQL code to combine 2 queries

    SELECT S.fldSubscriptionsSubscriberlastname & ", " & S.fldSubscriptionsSubscriberfirstname AS Expr1,

    S.fldSubscriptionsSubscrno,

    SA.fldSubscriptionsAddressesEffdate,

    SA.fldSubscriptionsAddressesHouseno,

    SA.fldSubscriptionsAddressesStreetname,

    R.fldRoutesRouteno,

    P.fldPublicationsName

    FROM ((tblSubscriptions S

    LEFT JOIN

    [SELECT SA2.fldSubscriptionsAddressesSubscrno,

    MAX(SA2.fldSubscriptionsAddressesEffdate) AS fldSubscriptionsAddressesEffdate

    FROM tblSubscriptionsAddresses AS SA2

    GROUP...

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

  • RE: Displaying every combo of unique id values

    How about this

    CREATE TABLE #TableB (GroupID int, [ID] int)

    DECLARE @groupid int, @id int, @max-2 int, @ct int

    SELECT @max-2 = MAX([ID]) FROM [TableA]

    SET @groupid = 0

    SET @id...

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

  • RE: declare cursor with dynamic Select

    If you want to use cursor with dynamic sql then try this

    DECLARE @sql nvarchar(4000)

    SET @sql = 'DECLARE mycurs CURSOR FOR SELECT col,col,col FROM '

    EXECUTE sp_executesql @sql

    OPEN mycurs...

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

  • RE: Query error ?!!!

    SELECT nc.id_doc AS [ID],

     n.publish_date,

     n.publish_time,

     n_content.title,

     n_content.abstract,

     n_content.lead,

     n.image_title,

            n.image_main,

            st.daily_stats

    FROM (

     SELECT  doc_id,

      SUM(doc_view_stats.hour_00 + doc_view_stats.hour_01 + doc_view_stats.hour_02 + doc_view_stats.hour_03 + doc_view_stats.hour_04 + doc_view_stats.hour_05

          + doc_view_stats.hour_06...

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

  • RE: Missing record!!!

    I use a tip from Antares to generate my Invoice numbers and use a control record

    e.g

    UPDATE ControlRecord

    SET @InvoiceID = InvoiceID = InvoiceID + 1

    WHERE ControlID = 1

    SET @ErrorNo = @@ERROR

    IF @ErrorNo <> 0...

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

  • RE: Mandatory photo at 1,000 posts?

    quoteBtw, I am younger than you...

    With age comes wisdom.

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

  • RE: Mandatory photo at 1,000 posts?

    Yeah, I think your brother got the better half of the deal

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

  • RE: Using NOT EXISTS on composite Key

    or

    SELECT HostName, ApplicationName

    FROM AppUsers

    GROUP BY HostName, ApplicationName

    HAVING SUM(CASE WHEN IsCustodian=1 THEN 1 ELSE 0 END) = 0

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

  • quotewouldn't it make this fora a bit more personell to make it mandantory for posters who crossed the...

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

  • RE: Row Count of Insert stmt with sp

    Based on your post

    @resQuery must be a select statement

    Following the INSERT @@ROWCOUNT will contain the number of rows inserted

    When you say that it is always zero, how do you know,...

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

  • RE: Conditional Date selection - Help needed

    quoteRegarding the funnies, I will take them in the spirit they were meant (I hope)

    Helen,

    The humerous anecdotes...

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

  • RE: Conditional Date selection - Help needed

    CASE WHEN start_date < '2004-05-01'

    THEN '2004-05-01'

    ELSE Dateadd(month,6,start_date)

    END AS [anniversary]

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

  • RE: Collation Issue

    Collation is set during installation of sql server and determines the collation for the system databases (eg master, tempdb) and the default for any created databases thereafter.

    You can override the...

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

  • RE: SQL Statement Help

    AJ,

    If your interested this would be the solution using COALESCE

    COALESCE(NULLIF(Col1,'HHHH'), Col2) AS [Result]

     

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

Viewing 15 posts - 2,446 through 2,460 (of 3,544 total)