Forum Replies Created

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

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Master database

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

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Master database

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

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Difficulties with the WHERE clause

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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(*)

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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'),(

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Composite Key Assistance

    You may or may not need to create another index for StoreNumber first.  It's possible SQL would never use such an index even if you created it.

    If you...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Merging user data

    If you have FK relationships, you don't have to do the data changes yourself.

    Script out the FKs, "DROP and CREATE", and change the "ON UPDATE CASCADE" to "ON...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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