Viewing 15 posts - 256 through 270 (of 413 total)
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...
September 13, 2005 at 7:43 am
Why can't you build one sp and use it for all your cases?
September 13, 2005 at 5:15 am
Why do you need to build that sp dynamically? The column names don't change, I suppose...
September 13, 2005 at 4:47 am
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...
September 13, 2005 at 3:47 am
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 + ', ')...
September 13, 2005 at 2:43 am
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...
September 13, 2005 at 2:34 am
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
September 12, 2005 at 6:30 am
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...
September 12, 2005 at 5:46 am
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...
September 12, 2005 at 4:54 am
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...
September 12, 2005 at 4:43 am
Just calculate sum(len()) before you start, and if that's more than 8000, don't do it
September 9, 2005 at 6:49 am
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...
September 9, 2005 at 6:44 am
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...
September 9, 2005 at 5:19 am
Sure, I guess we all feel that our own code is the simplest...
September 8, 2005 at 6:37 am
Viewing 15 posts - 256 through 270 (of 413 total)