Forum Replies Created

Viewing 15 posts - 8,146 through 8,160 (of 8,731 total)

  • RE: timeline in cross-tab??

    Check the code and look for the part where the sql statement is completed and stored into @sql.

    In there, you just have to add the INTO clause.

    You might want to...

    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: timeline in cross-tab??

    r_slot (4/10/2013)


    Thanks a lot Steve: I understand you solution a little bit better than the others, but the subject stays difficult for me. When I look into the messages 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: Rounding up

    ScottPletcher (4/9/2013)


    SQL will automatically cast the result to the receiving data type; cast will automatically round.

    I've always thought it truncated the decimals instead of rounding them (which also happens). Afters...

    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: Need Help in SQL Pivot Query

    Is there any reason to use ROLLUP when a simple GROUP BY is 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: timeline in cross-tab??

    It's good to know the solution worked fine. However, you should understand it before using it.

    Two tips I can give you are to use the PRINT command I included 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: Rounding up

    It shouldn't be rounding if you're not explicitly rounding it.

    Can you post DDL for the table that contain those fields?

    If you're using ROUND(), use the third argument (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: split single row into multiple lines

    Something like this?

    WITH Sample_Data AS(SELECT 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' string)

    SELECT SUBSTRING( string, 1, 10) + CHAR( 10) +

    SUBSTRING( string, 11, 10) + CHAR( 10) +

    SUBSTRING( string, 21, 10) + CHAR( 10)...

    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: timeline in cross-tab??

    This is mostly a dynamic cross-tab. It's not that hard when you understand them, but you need to be really careful on what you're doing.

    Please, test the code and be...

    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: Need Help in SQL Pivot Query

    Are you serious j.miner? Take a look at J Livingston code, it's way simpler.

    I just would change the having clause for a where clause (to filter the information before grouping...

    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: split single row into multiple lines

    You could use CHAR(10) or CHAR(13) (depending on the output).

    Could you give an example on what you're trying to do? or explain more the reason to have several lines?

    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 to Seperate number from a text

    Steven, it's great that you look for alternate solutions. However, you might want to make it simpler. You're scaning the "table" multiple times and using several window functions. If you're...

    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 a table when new record

    I got more confused.

    Could you give an example of what you have and what you need to get? Avoid using "these table", "another table", instead of that, you should name...

    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 to Seperate number from a text

    This should do the trick to avoid ISNUMERIC

    WITH CTE AS(

    SELECT 'SBA 60 OFF 19.99 NOW 7.99' as String

    UNION ALL

    SELECT 'SBA 50 OFF 99.99 NOW 49.99'

    UNION ALL

    SELECT...

    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 a table when new record

    You could do it via trigger FOR INSERT or as part of the procedure used to insert the row using the OUTPUT clause.

    However, if you're just copying all the rows...

    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: Join on 2 tables where values are different

    The queries will be inefficient, unless you correct your data.

    Here's one option, but you'll have a problem with "SouthWest"

    SELECT *

    FROM #TableRegion t1

    FULL JOIN #TableRegionOther t2

    ON CHARINDEX( SUBSTRING(t1.Region, 2, 4), t2.Region)...

    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 - 8,146 through 8,160 (of 8,731 total)