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...

  • 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...

  • 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...

  • RE: Need Help in SQL Pivot Query

    Is there any reason to use ROLLUP when a simple GROUP BY is enough?

  • 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...

  • 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...

  • 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)...

  • 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...

  • 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...

  • 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?

  • 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...

  • 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...

  • 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...

  • 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...

  • 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)...

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