Forum Replies Created

Viewing 15 posts - 3,481 through 3,495 (of 7,619 total)

  • RE: Db name inside the stored proc

    If you're on an installed version of SQL, rather than SQL Azure, just create the proc in the master db, mark it as special, and then it will run 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: SQL Server 2016 REF 70-761 question

    Ethically, I don't like commenting at all on test dumps.

    But G isn't right either, no matter what MS says.  The valid datetime comparison for the year of 2014...

    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: SQL Server Agent Job question

    Try using the 
    FOR XML
    option in the SQL query (SELECT).\

    I'm not sure if that will work as you want it to (I think it probably should), and...

    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: Updating null fields wehn changing field to not null.


    ;WITH cte_assign_Item_ID_values AS (
      SELECT *, ROW_NUMBER() OVER(PARTITION BY Ref ORDER BY Traveller) AS row_num
      FROM dbo.table_name
    )
    UPDATE cte_assign_Item_ID_values
    SET Item_ID = row_num

    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: SQL Server Agent Job question

    Don't use a temp table (I didn't).  Just use a "real" table name.  Not a bad idea to keep a copy of what was exported until the next run anyway. ...

    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: SQL Server Agent Job question

    bcp exports the results of a table, view or query, not the results of a procedure execution.

    You'll need to capture the results of the proc into a table,...

    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: How many active orders were there at the close of each day

    Great, I'm very glad it helped!

    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: How many active orders were there at the close of each day

    Much harder without consumable sample data, but something like below should be really close at least.  I'm not 100% sure on the specific end date determination you want, but 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: Reverse engineering a duty rate when dealing with small values

    All taxing authorities I know of at least allow rounding of tax amounts, and afaik all businesses do it.  After all, it's ultimately extra money to them to charge more...

    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: Reverse engineering a duty rate when dealing with small values

    I don't believe there is, since the value is rounded up.  You can calc the rate that would produce the rounded-up amount, but I can't see how  you would ever...

    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: How to write this query?

    I don't really see the need for the overhead and potential issues of reading the sys.all_columns view.


    ;WITH
    cteTally10 AS (
      SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))...

    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: Pivot 2 columns


    SELECT FieldName,
      MAX(CASE WHEN ID = 2 THEN RecordCount END) AS OldCount,
      MAX(CASE WHEN ID = 1 THEN RecordCount END) AS NewCount,
      MAX(CASE WHEN...

    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: Spilt a record into 4

    Prob not "the best way", but I think it works:


    select ssalesid, salesname, salesamount_split, rank
    from (
      select 1 as ssalesid, 'cust1' as salesname, cast(101.50...

    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: Balancing Performance and Readability

    GeorgeCopeland - Tuesday, March 20, 2018 9:52 AM

    I think it is interesting to note how quickly the discussion between two DBAs went off-topic....

    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: Optimizer Changes / New need for join hints on views?

    Are they covering indexes?  Just having a nonclustered index on a joining column(s) is often not useful for SQL, unless that index fully covers the query.

    I have had...

    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,481 through 3,495 (of 7,619 total)