Forum Replies Created

Viewing 15 posts - 6,061 through 6,075 (of 8,731 total)

  • RE: Multiple joins to the same table

    I often think of APPLY as a JOIN on steroids. 😀

    Apply will allow you to use correlated subqueries as tables/views or columns from other tables as parameters of functions. I...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Multiple joins to the same table

    That's a lengthy code. Instead of including a whole set of columns in a group by, I used a correlated subquery with CROSS APPLY. You can do the same with...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Returning MAX(Value) in String

    This is a possible solution. Be sure to understand how does it work and ask any questions that you have.

    SELECT Reference,

    PARSENAME( r.dotted, 3) + '.'...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Calculate EndDate From Subsequent StartDate

    To give the example of LEAD() as proposed by LinksUp.

    SELECT categoryID,

    EffectiveDate AS StartDate,

    DATEADD( dd, -1, LEAD(EffectiveDate) OVER( PARTITION BY categoryID ORDER...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Merge Problem!!

    AFAIK, you need an additional step as the condition differs for the "NOT MATCHED BY Source".

    You could do it like this:

    MERGE #Grantors as Target

    USING #tempTors as Source

    ON (Target.EntryNumber...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    Steve Jones - SSC Editor (7/28/2014)


    Luis Cazares (7/28/2014)


    Semicolon is not a separator, it's a terminator. The proof of that is the MERGE statement which needs to be ended with a...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Getting error message while using csv file

    Do you have unicode values in your file? If you don't you could clear the unicode checkbox in the flat file connection. If you do, you need to change the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Msg 241, Level 16, State 1, Line 1 Conversion failed when converting date and/or time from character string.

    You might not need a convert, you need to check all the values are valid dates.

    I feel the problem is with TERM.[Actual Terminated Date]

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    The Dixie Flatline (7/28/2014)


    I respect and admire all you guys for your professionalism, and often restraint, in dealing with all manner of questions. Steve does a great...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Display negative seconds in HH:MM:SS format

    Didn't realize that this was for reporting services until I was posting. Maybe this T-SQL code might give you an idea.

    DECLARE @Seconds int = -223

    SELECT CASE WHEN @Seconds <...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Multiple joins to the same table

    I'm just guessing here, but maybe a cross tabs approach is what you need to read the table just once.

    Example:

    SELECT x.Somecolumns,

    MAX( CASE WHEN OrderOfDiagnosisInEpisode = 1...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: T-SQL Counting: difference of two methods?

    Just wanted to note that you won't see much difference with 5 rows. Anything will run fast with 5 rows. That's why performance tests usually start at least with 1000...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How many tests do I need for 2012 after I get my MCITP

    GilaMonster (7/25/2014)


    quackhandle1975 (7/25/2014)


    Edit: I would have thought 459 would have been the most challenging exam being the "Expert" one.

    None of them are 'expert' level. Not even close.

    Redefine 'expert' level as...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Group by Parent with one child and multiple child information

    Welcome to the forums.

    It's considered a nice way to ask for help if you post your data in a consumable format. As you're new, I did it for you, but...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Running Total on 2 columns

    If you're using SQL Server 2012, the easiest method (not the fastest) would be something like this:

    select a.acctnum,

    a.dates,

    a.transtype,

    b.balance,

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 6,061 through 6,075 (of 8,731 total)