Forum Replies Created

Viewing 15 posts - 6,346 through 6,360 (of 8,731 total)

  • RE: insert into from multiple CTE

    Remember that CTEs will be available only for one statement and not the whole query/procedure.

    Think of them as some kind of re-arranged subqueries.

    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: dynamic pivot issue

    This will generate the dynamic pivot for any number of years.

    Read more about it in the following article: http://www.sqlservercentral.com/articles/Crosstab/65048/

    DECLARE @Years nvarchar(4000) = '',

    @Amt1 nvarchar(4000)...

    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: insert into from multiple CTE

    And where are you using table2?

    You didn't include the CTE definitions and there's a lot of missing information.

    Please include the whole code to understand the problem.

    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: uses of string splitters

    sqldriver (6/4/2014)


    I didn't see this code in the initial capitalization thread. It's what I've been using happily for a couple years. Not sure how it compares to the other solutions.

    You...

    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: Pivot option

    There's an alternative you can read about in here:

    http://www.sqlservercentral.com/articles/Crosstab/65048/

    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: List value based on another field value - Query question

    Or maybe something like this:

    CREATE TABLE Employee(

    EMPID int,

    FNAME varchar(100),

    LNAME varchar(100))

    CREATE TABLE Contact(

    ...

    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: Recursively get list of trades in portfolio

    This is just a suggestion and keep in mind that I don't have many details, but I'd usually work with something like this:

    CREATE TABLE Portfolio(

    PortFolioID ...

    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: Recursively get list of trades in portfolio

    This is an option. I'm not sure about it. I wonder if there's a better option with this structure. Would it be possible to make changes to the table?

    DECLARE @PortfolioID...

    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: Recursively get list of trades in portfolio

    Sean Lange (6/3/2014)


    Luis Cazares (6/3/2014)


    That's an uncommon hierarchy structure. Usually the children have the reference to the parent and not the other way around (that reduces rows from the table).

    Could...

    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: Just curious, what are your SQL pet peeves ?

    patrickmcginnis59 10839 (6/3/2014)

    So whats the beef with "best practices"?

    I'm sure the problem is with the:

    objectively bad recommendations listed under a title "best practices"

    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: Recursively get list of trades in portfolio

    That's an uncommon hierarchy structure. Usually the children have the reference to the parent and not the other way around (that reduces rows from the table).

    Could you give an example...

    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: Just curious, what are your SQL pet peeves ?

    patrickmcginnis59 10839 (6/3/2014)


    Rudyx - the Doctor (6/3/2014)


    A great list discussion - my 3 cents:

    - table variables need to be depracated with extreme prejudice

    - SSMS generated code (IMAX screen...

    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 first and last value for every group.

    I noted the same thing when I was testing the code and mention it in my original post. I thought that the sample data might be wrong and posted 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: View Server State permission

    You're right. Private emails (or any form of communication) is better when dealing with this. People will react better than when you call them out in public and there are...

    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: Add month to a Date

    I'm surprised that Jeff didn't mention that recursive CTEs that count are a form of hidden RBAR (and he usually mentions it even with such few rows).

    Here you have...

    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,346 through 6,360 (of 8,731 total)