Forum Replies Created

Viewing 15 posts - 151 through 165 (of 188 total)

  • RE: Orderlines into columns dependant on positive or negative quantity

    oops i meant:

    select

    client,

    article,

    sum(case when quantity > 0 then quantity else 0 end) delivered,

    sum(case when quantity < 0 then quantity else 0 end) returned

    from #temp

    group by client, article order by 1

  • RE: Orderlines into columns dependant on positive or negative quantity

    select

    client,

    article,

    sum(case when quantity > 0 then 1 end) delivered,

    sum(case when quantity < 0 then 1 end) returned

    from #temp

    group by client, article order by 1

     

    You can DTS into Excel, or you...

  • RE: Using the REPLACE function

    Note too that Unix will return a line feed and no carriage return!

    Use something like this to find out what the ascii value of each character is:

    declare @i as integer

    declare...

  • RE: Identifying changed rows in a table

    Maybe something like this?

    INSERT INTO tbl_report

    SELECT * FROM tbl_report_refresh r

    WHERE NOT EXISTS

    (SELECT * 

    FROM tbl_report s

    WHERE

    s.col_a =  r.col_a

    AND

    s.col_b = r.col_b

    ETC...

  • RE: Advanced T-SQL

    I completely misunderstood what you wanted - I thought you were looking for a single character from the entire field!

    Well, congratulations on your success! Half the fun of this...

  • RE: Advanced T-SQL

    Okay, let's try this:

    1 - Test the length of the text field and compare it to the varchar length. Are you getting all of it? I have...

  • RE: Advanced T-SQL

    That was pretty vague. Maybe you need to answer ThomasH's questions before going any further. I assumed you could convert to varchar. Maybe not? Is this...

  • RE: Proper Data Type

    Good point, Frank! I only need enough accuracy to report on call center stats, so I don't need the accuracy of a larger data type in my report level...

  • RE: Proper Data Type

    Numeric(9,2) only uses 5 bytes, gives you two places past the decimal, say for cents. Good choice for storing bank account or credit card balances; or call center (time)...

  • RE: Advanced T-SQL

    DECLARE @test-2 AS VARCHAR(8000)

    DECLARE @TEST2 AS VARCHAR(8000)

    DECLARE @POS AS INT

    DECLARE @POS2 AS INT

    SELECT @test-2 = (SELECT CAST(TEST AS VARCHAR(8000)) FROM TBL_TEST)

    SET @POS = (SELECT DATALENGTH(@TEST)-PATINDEX('%[1-9]%', REVERSE(@TEST))+1)

    SELECT...

  • RE: Advanced T-SQL

    Position needs to refer to A SINGLE character somewhere. What character do you want to find? The '5'? The'g' at the end of the sentence? The first...

  • RE: Advanced T-SQL

    Then maybe you want the line feed character at the end of the last line in bullet(5)?

    Jules

  • RE: Advanced T-SQL

    I'm sorry, please explain. (1)%(5) refers to the entire bulleted list? So you want to find the position of the '1'? The '5'? Or both? ...

  • RE: Advanced T-SQL

    SELECT DATALENGTH('aa(1)aaaaa(1)aaaaa')-PATINDEX('%[(1)]%', REVERSE('aa(1)aaaaa(1)aaaaa')) --will give you the position of the '1' in the middle.

    You will still have to jack with it a bit depending on whether you want the position...

  • RE: DTS Numbers export to Excel ends up as text

    Okay, I tried this several different ways and could not produce your successful results. DTS was only able to successfully run the drop/create statements against an existing page$, not...

Viewing 15 posts - 151 through 165 (of 188 total)