Forum Replies Created

Viewing 15 posts - 3,616 through 3,630 (of 7,615 total)

  • RE: Insert sets of IDs and Years into a table

    What you need/want is a CROSS JOIN.  That will match every ID with every year:


    SELECT n.ID, y.year
    FROM dbo.Name n
    CROSS JOIN (
        SELECT...

  • RE: Master database

    The hard task, that's not trivial, is changing to use a sophisticated, automated scripting mechanism to push the same script out to hundreds of databases, or a selected sub-set of...

  • RE: Master database

    But the OP doesn't have all that in place, and, as I said before,  it's NOT trivial to do.

    Ssometimes the most practical solution is the best. By way...

  • RE: Master database

    Luis Cazares - Thursday, January 11, 2018 10:42 AM

    I get why you would want to use master database and mark them as...

  • RE: Master database

    Thom A - Thursday, January 11, 2018 10:13 AM

    ScottPletcher - Thursday, January 11, 2018 10:05 AM

    January 11, 2018 at 10:18 am

    #1975550

  • RE: Master database

    Thom A - Thursday, January 11, 2018 9:00 AM

    ScottPletcher - Thursday, January 11, 2018 8:31 AM

    January 11, 2018 at 10:05 am

    #1975543

  • RE: Master database

    I'd put the stored procs in the master db.  You have no choice to get a "shared" proc.  The name must start with "sp_".

    I'd put the functions in...

  • RE: New to SQL help with script please

    Here's my best guess of what you want to do:


    UPDATE RXS
    SET QTY=RXS_Totals.Qty_Total
    FROM FWDB.RX.RXS RXS
    INNER JOIN (
      SELECT FacID, PatID, NDC, SUM(Qty)...

  • RE: SELECT all negative values, that have a positive value

    Another alternative; you could list up to 3 distinct grp values this way -- beyond 3 you would need to use a different method.


    SELECT ABS(id)...

  • RE: Difficulties with the WHERE clause

    Or change OrdNo to int and avoid all that ridiculous mess!

  • RE: Count based on weekend days

    I prefer to avoid language dependency when possible, and therefore use a "standard" relative day# for day of week rather than a day name.

    SELECT CreateDayAdjusted, COUNT(*)

  • RE: I have to get a count of orders placed between 1 pm yesterday and 1 pm today by day

    Here's one way:


    SELECT CAST(DATEADD(HOUR, 11, OrderDate) AS date) AS Date,
      COUNT(*) AS Count
    FROM (VALUES
     (908, '1/3/2018 13:20:34'),(
    909, '1/3/2018 15:18:41'),(
    910, '1/4/2018 09:15:21'),(

  • RE: Issue with ROW OVER partition


    SELECT {column_list, ...}
    INTO #TEMP2 -- Max ZATS
    from
    (
    Select
    ZBF.[HTS_NUMBER]
    ,#TEMP1.Part_Num
    ,row_number() OVER (PARTITION BY Composite_part ORDER BY Insert_Date DESC) AS Max_Date
    ,Max ([TSI].[ZATS_BROKER_FEED].Insert_Date) as...

  • RE: Adding indexed computed column to vendor system-any negative impacts?

    Create views to do the joins.  Yes, users shouldn't be expected to correctly write 5-column joins.  And they never should -- they should use a view that does the join(s)...

  • RE: Convert from datetime to varchar to int


        , cast (convert(varchar(8), po.PolicyIssueDt, 112) as int) as PolicyIssueDt

        , cast(convert(varchar(8),po.PolicyEfftvDt, 112) as int) as PolicyEfftvDt

        , cast(convert(varchar(8), po.PolicyExpirDt, 112) as int) as PolicyExpirDt

Viewing 15 posts - 3,616 through 3,630 (of 7,615 total)