Forum Replies Created

Viewing 15 posts - 271 through 285 (of 1,414 total)

  • Reply To: BASE64 Encode and Decode in T-SQL

    For posterity since 2012 the built-in method for converting to base64 is using XML.  This comes up every now and then on SSC.  The only post I could find tho...

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

  • Reply To: First Two Words

    Already had dbo.fnTally.  Here are the results which show 7 or 8 seconds for CHARINDEX and 33+ seconds for STRING_SPLIT.  This is my tiny Azure SQL compatibility level 150 test...

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

  • Reply To: First Two Words

    Jonathan AC Roberts wrote:

    I don't think calling complicated string_split and string_agg functions will be more efficient than calling simple string functions.

    Maybe so.  Can your chatbot make the case for it?  Splitting and...

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

  • Reply To: First Two Words

    Imo davidandrews13 has the right idea.  In SQL 2022

    select string_agg(sv.[value], ' ') within group (order by sv.ordinal) first2_in_order
    from #temp t
    cross apply (select...

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

  • Reply To: Replace function not working

    Could be a type mismatch due to the search string not being specified with the Unicode prefix N'...'

    declare @json nvarchar(max)=N'Array ( [error] => Quote not found [module]...

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

  • Reply To: Islands (no gaps) - Problem solved but could this be done better?

    Here's an alternative.  Is it better, idk

    with 
    gap_cte as (
    select *, case when UserTier<>lag(UserTier) over (partition by UserID order by StartDate) then 1...

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

  • Reply To: Use a flag, or calculate, to retrieve counts

    Imo it depends on whether or not Approved is exactly equivalent to Taken.  Could a user be officially approved and yet not take the day?  If there's an exact equivalency...

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

  • Reply To: Update row using different steptype within same order

    It could be two similar queries.  For the first one maybe you could try something like this.  It uses OUTER APPLY but LEFT JOIN would probably also work

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

  • Reply To: Query

    Jeff Moden wrote:

    Good lord. 🙁

    It's got to have you wondering, no?  Where the line is to be drawn?  How many doublings do we have remaining?  What really changes because I'm still...

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

  • Reply To: Query

    vs.satheesh wrote:

    Thank you.I am looking select statement

      Ok thank you.  Still have some questions tho

    Example 1:

    exec spLiceceQty @Productid=1,@LicenceQty= 10

    I want the following result set

    1, 2023-02-15 14:47:16.927, 25

    Why...

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

  • Reply To: Query

    What determines the hierarchy of 'LicenceQty' row values from which to begin the subtraction?  In the case of ProductID=1 the example appears to apply lifo, "last in, first out", and...

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

  • Reply To: Query

    Well, what does the chatbox have to say about this one?  It doesn't look too tricky imo

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

  • Reply To: Aggregate Select Results and convert Secs to Hours Mins.

    Jeff Moden wrote:

    BTW and just to clarify, I'm damned impressed with what they've been able to get ChatGPT to do.  The technology behind all of that is mind boggling .  My...

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

  • Reply To: Sampling : Select the sample records

    Presumably there are other employees besides Betty?  If so it would be convenient to start with a table containing (unique) employees and the sample size.  In the case where you're...

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

  • Reply To: Case expression with NULL

    The question came up based on this forum post.  Not sure I'd know the answer otherwise

    https://www.sqlservercentral.com/forums/topic/nullif-in-ssis#post-4122037

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

  • Viewing 15 posts - 271 through 285 (of 1,414 total)