Forum Replies Created

Viewing 15 posts - 1,306 through 1,320 (of 1,424 total)

  • Reply To: Remove the middle of a string between wildcards

    If 'jsonpayload' is valid JSON it could be updated in place.  Using Sql 2016+ something like this (copy, paste, run) could work:

    /* create a test table with...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: how to rollback transaction explicitly

    Is there a business definition that defines an "error" or is the error table only supposed to contain errors generated by sql?  Please post the definition of the student table...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Creating Function to use C# Class Library Method

    chris_barnhart wrote:

    I wasn't taking into consideration the Convert.To/FromBase64 calls that are used with the decryption method, so I wasnt converting to or from Base64 when i was performing the substring,...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Creating Function to use C# Class Library Method

    chris_barnhart wrote:

    ..., then store the decrypted value(s) into a MySQL database.  My task is now to get said Data onto our Reporting SQL Server and store as decrypted.

    The MySQL is...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: transactions(Try, commit and rollback)

    Could you provide the definitions for the tables that you reference?  Is there an integer identity primary key on id in the student table?

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Using SELECT LEFT and WHERE IN in the same SELECT Statement.

    Here's a tvf named 'left_chars' that attempts to generalize all of the requirements.  Sorry I'm learning about APPLY (new hammer) so everything looks like a nail.  The function should work...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: redistribute by total dollar value (not by count)

    If the dollar values are randomly distributed across rows then any sample (of sufficient size, about 35 for reasonable precision and confidence) should have an average $/cust that's close to...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: count number of days between two dates excluding weekends for a particular month

    It would be similar to what was posted except using your calendar table instead of the daterange function.  Eomonth can't be used either because it's Sql 2016+.

    Something like this:

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: count number of days between two dates excluding weekends for a particular month

    Yea yea, I know or I noticed after I posted that.  Instead of eomonth() you could use:

    dateadd(day,-1,dateadd(month,1,@test_month))

    Then you could use a tally table and dateadd function.  Or...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: count number of days between two dates excluding weekends for a particular month

    This is an application for Jonathan's daterange function.  Here is his article:

    https://www.sqlservercentral.com/scripts/a-daterange-table-valued-function

    Something like this:

    declare
    @input_yearint=2019,
    @input_monthint=9;
    declare
    @test_monthdate=datefromparts(@input_year,@input_month,1);

    select
    count(*) days_in_month_excluding_wkends
    ...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Checking if a value has been set/changed in week/month from audit table

    robtyketto wrote:

    I'm thinking of check where the status is that of 12 as in the example for a month period, this is done via a mechanism of a table that...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Checking if a value has been set/changed in week/month from audit table

    The top(1) protects from row expansion due to the inequality on date.  That was the part I wasn't getting.

     

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Checking if a value has been set/changed in week/month from audit table

    If I'm understanding correctly there's a table with many status columns per userid.  When any of the statuses change a new record is inserted which duplicates the unchanged statuses.  Fyi,...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Assemblies and SQLCLR with SQL Server 2017

    dotPeek could decompile the dll's if you'd like to see the source code.  It's free and there's no registration or email required to download and install it.

    https://www.jetbrains.com/decompiler/download/

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: @@TRANCOUNT

    I agree with James one transaction would likely be a good idea.  To see how the trancount changes with successive trans/commits:

    drop proc if exists temp_proc;
    go
    create proc temp_proc
    as
    begin
    drop...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Viewing 15 posts - 1,306 through 1,320 (of 1,424 total)