Forum Replies Created

Viewing 15 posts - 16 through 30 (of 562 total)

  • Reply To: FUN only, solving a Puzzle.

    After 'solving' this puzzle, I looked on line for other solves. Found :

    https://is.gd/Sudoku_shortest_solver

    The shortest on that site mentioned is 101 bytes K program. (In C the shortest is 174...

  • Reply To: FUN only, solving a Puzzle.

    WITH N AS(SELECT*FROM(VALUES('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'))s(n))
    ,S AS(SELECT'000071006002400810900600030007000600800000004005000300090004002051003900400950000's,1i
    UNION ALL SELECT LEFT(stuff(s,i,1,n),81),patindex('%0%',stuff(s,i,1,n))FROM S,N WHERE i>0 AND
    ...
  • Reply To: FUN only, solving a Puzzle.

    ChrisM@Work wrote:

    Ben, I'm sure this has already been done here, and the final solution is as skimpy as Taylor Swift's bikini.

    Edited to add link: https://jasonbrimhall.info/2011/08/23/tsql-sudoku-ii/

    Thank you Chris,

    Especially for the...

    • This reply was modified 4 years, 4 months ago by  ben.brugman. Reason: typo
  • Reply To: Working with variable length number

    ---------------------------------------------------------------------------------------------------------------------------
    -- Same algoritm, but done in discrete steps.
    ---------------------------------------------------------------------------------------------------------------------------
    drop table if exists C

    Create table C(nr1 bigint, reverse_string1 varchar(100), reverse_nr1 bigint,nr2 bigint, reverse_string2 varchar(100), reverse_nr2 bigint, back bigint,...
  • Reply To: Working with variable length number

    Example data :

    ---------------------------------------------------------------------------------------------------------------------------
    -- Ben Brugman
    -- 20200102
    ---------------------------------------------------------------------------------------------------------------------------
    -- Create some example tables.
    drop table if exists number1
    drop table if exists number2
    Create table Number1(nr1 bigint)
    Create table Number2(nr2 bigint)

    -- Insert some examples.
    insert...

    • This reply was modified 4 years, 6 months ago by  ben.brugman.
    • This reply was modified 4 years, 6 months ago by  ben.brugman.
    • This reply was modified 4 years, 6 months ago by  ben.brugman. Reason: During optimization of the code some errors where introduced
    • This reply was modified 4 years, 6 months ago by  ben.brugman.
  • Reply To: How to calculate income tax for a slab based taxation system?

    CREATE TABLE #tax_brackets (
    income_minimum decimal(9, 2) NULL,
    income decimal(9, 2) NOT NULL,
    tax_rate decimal(5, 4) NOT NULL
    ...
  • Reply To: Fastest Way to Calculate Total Number of records inserted per day

    The query is (to my knowledge) not based on the updated statistics. I have been using this query a lot on many different systems and use this query mainly to...

  • Reply To: Fastest Way to Calculate Total Number of records inserted per day

    First the conclusion :

    Count(1) and count(*) perform similar.

    Getting the count from the meta tables is a lot faster.

    Based on a test with a table with 1 000 000 (one milion)...

    • This reply was modified 4 years, 6 months ago by  ben.brugman. Reason: Formatting of the text :-( :-( :-( :-(
  • Reply To: BCP utility

    --
    -- Create a text for a CSV file. (Not a file).
    -- Strings with double qoutes, semicolons or CRLF get qouted and the double qoutes are 'escaped' with...

    • This reply was modified 4 years, 7 months ago by  ben.brugman. Reason: BBCodes mangle the correct SQL into something unreadable
    • This reply was modified 4 years, 7 months ago by  ben.brugman.
    • This reply was modified 4 years, 7 months ago by  ben.brugman.
    • This reply was modified 4 years, 7 months ago by  ben.brugman. Reason: Working around the effects of BCCoding. (Mangling of the displayed script)
  • Reply To: Fastest Way to Calculate Total Number of records inserted per day

    To get the number of rows in 'each' table :

               SELECT o.name, SUM(p.rows) sum_rows
    FROM...
  • Reply To: Audit Log.

    Thanks for all the responses, I will look into the responses and more specific into the links (CDC).

    CDC captures a lot but has to be specified for all tables  🙁 ...

  • Reply To: Audit Log.

    Prologue:

    A large number of database systems provide something like an Auditing Trail or Log.

    Sometimes primitive, sometimes difficult to read, sometimes based on data, sometimes based on command/instructions/scripts.

    SQL-server lacked (at least...

  • Reply To: Audit Log.

    Maybe I was not clear (sorry):

    Maybe the answer is: "Use the most recent Enterprise edition."

    At this moment I do not use the Enterprise edition, that's why I asked the question....

    • This reply was modified 4 years, 7 months ago by  ben.brugman.
  • Reply To: Audit Log.

    Mainly (???)

    Data changes.

    A requirement is that something similar to SQL Anywhere Auditing is implemented. For two main purposes:

    1. To discover problems with the database and/or database software. (Debugging problems).

    2. To...

  • Reply To: list to table, versus delimitedsplit8k

    As said, a follow up.

    Because I was still checking and testing some scenario's I didn't respond before.

    The 'main culprit' why the delimitedsplit8k was not performing as expected was that during...

Viewing 15 posts - 16 through 30 (of 562 total)