Forum Replies Created

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

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • RE: Mandatory photo at 1,000 posts?

    quoteBtw, I am younger than you...

    With age comes wisdom.

  • RE: Mandatory photo at 1,000 posts?

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

  • 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

  • quotewouldn't it make this fora a bit more personell to make it mandantory for posters who crossed the...
  • 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,...

  • 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...

  • 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]

  • 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...

  • RE: SQL Statement Help

    AJ,

    If your interested this would be the solution using COALESCE

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

     

  • RE: SQL UDF to return hours

    Self taught, mostly by practice and looking at samples and experience. BOL and web search helps and looking at forums like this one. This forum has a lot of articles...

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