Forum Replies Created

Viewing 15 posts - 6,466 through 6,480 (of 8,731 total)

  • RE: query help needed

    You really love to overcomplicate things.

    Even worse, I can force the order of execution with derived tables. I materialize one of the joins, thus

    ((T1

    INNER JOIN

    T2

    ON T1.a = T2.a)

    AS X

    T3

    ON X.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: Creating a custom column

    That's the beauty of relational databases, you don't need to store the repeated values. You just need to use the joins wisely.

    CREATE TABLE #Employees(

    emp__id char(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: Creating a custom column

    npatel 17252 (5/14/2014)


    What I want to do is add a column that has 5 values and create a row for each value

    Why would you do such a thing?

    This would denormalize...

    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: Making a record set horizontal

    You might need to create a dynamic cross tab. I'm not sure if you will face problems with some limitations on columns or strings.

    Read about them 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: create a table using the value of a variable

    You need to use dynamic code. But that will open the possibility of SQL injection.

    http://technet.microsoft.com/en-us/library/ms188001.aspx

    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: Flip two words

    mickyT (5/14/2014)


    However having said that, this could be another way of attacking the problem

    Until you find that Gordon Abraham and Abraham Gordon (or any other combination of names) are two...

    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: Help Need in combining Result in Column level

    Sean Lange (5/14/2014)


    I would drop the mapping table and add another column to the Item table named ParentItemID. Then this is a simple recursive cte.

    I saw the single parent-child relationship...

    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: Help Need in combining Result in Column level

    You don't need UNION ALL. UNION will add rows and you need to add columns. To add columns, we use JOIN.

    In this case, you need some kind of self join...

    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: Sum in tricky way, how to make it beautiful??

    Using the CASE and OVER clauses instead of reading three times the same table. 😉

    ;WITH T AS (

    SELECT 1111 CustID, 201201 MonthID, 10001 Amt UNION

    SELECT 1111...

    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?

    SQLRNNR (5/14/2014)


    Luis Cazares (5/14/2014)


    I'm afraid, "he-who-shall-not-be-named" is back in the forums.

    I hope that I can behave well enough.

    Who? Tom Marvolo Riddle?

    Close enough if you add nose, goatee and some...

    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: query help needed

    You're assuming that all people think the same way.

    People that think in sets, are very capable to understand commutativity so they can understand that a + b + c...

    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: Does running multiple SQL queries in the same SP cause latency ?

    Maybe you're experiencing some kind of waits or blocking.

    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?

    I'm afraid, "he-who-shall-not-be-named" is back in the forums.

    I hope that I can behave well enough.

    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: Check my query

    That will work to get a single value. If you need several values/groups, you could read about it in the following article:

    http://www.sqlservercentral.com/articles/comma+separated+list/71700/

    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: query help needed

    It's funny how Joe Celko can suggest that someone learns so many ISO standards and can't even learn an ANSI standard that has been out for 22 years. Please use...

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