Forum Replies Created

Viewing 15 posts - 256 through 270 (of 413 total)

  • RE: more efficient way of executing a procedure?

    Try this:

    select

    case when @ReportType = 'A' then ColumnA else null end,

    case when @ReportType = 'B' then ColumnB else null end,

    count(*) from test_table

    group by

    case when @ReportType = 'A' then ColumnA else...

  • RE: Dynamic execution of stored proc

    Why can't you build one sp and use it for all your cases?

  • RE: Dynamic execution of stored proc

    Why do you need to build that sp dynamically? The column names don't change, I suppose...

  • RE: request help with where clause

    I think you need to insert the different months into a table (could be a temp table) in order to have something you can use in a join with your...

  • RE: SQL String Concatenation

    Agree on the first comment, but not on the second. Try this:

    Declare @Var as varchar(1000)

    set @Var = ''

    Select @Var = @Var + case when len(@Var) + len(name + ', ')...

  • RE: Left Outer Join

    I think I know what you are missing now. The "G.CharField1" in the join clause is not the same as the "G.CharField1" in the where clause. The former is a...

  • RE: Left Outer Join

    Exactly - so your join condition is true (at least for some rows) when you don't comment anything out, and false when you do..... I think

  • RE: Left Outer Join

    Replace the join condition by the trivial statement "1=1" (such that you are left joining on 1=1). Then replace "1=1" by the (equally trivial) statement "1=2". What happens? I guess you...

  • RE: SQL String Concatenation

    This is probably because the where condition is evaluated before, and not while, the select is executed. I think, however, that the following could be what you want (referring to the...

  • RE: Left Outer Join

    The problem could be that all rows in the table resulting from the left join, for which SUBSTRING(D.VarcharField1, 1, 4) = 'GLLA', fulfill the condition that G.CharField1  IS NOT NULL. But...

  • RE: SQL String Concatenation

    Just calculate sum(len()) before you start, and if that's more than 8000, don't do it

  • RE: to nest cases or not?

    What is the error message?

  • RE: SQL String Concatenation

    I didn't know that it wasn't supported.... It would be great if there were a built-in sum function for strings (like the sum function for...

  • RE: SQL String Concatenation

    I have posted what I hope is a solution to your problem below. But if someone knows a dirrerent solution (without loops and, if possible, without functions), please post it...

     

     

    create table tradeTable(AddressID...

  • RE: Trim all user tables with nvarchar datatype

    Sure, I guess we all feel that our own code is the simplest...

Viewing 15 posts - 256 through 270 (of 413 total)