Viewing 15 posts - 5,116 through 5,130 (of 8,731 total)
How do you you know that C is the sum of A and B and not any of the other values? How do you know that O shouldn't sum the...
March 17, 2015 at 11:06 am
How would you expect to differentiate both product groups?
March 13, 2015 at 7:29 pm
You need to alias your max(val) column. 😉
March 13, 2015 at 12:31 pm
Could you use something like this?
J.[Week] BETWEEN ISNULL(@WeekBegin, -1) AND ISNULL(@WeekEnd, 9999999)
Functions on parameters don't affect SARGability.
March 13, 2015 at 9:45 am
You have 2 options:
1. Use a UNION ALL with one query including a detail of the products and another one aggregating the information.
2. Use GROUPING SETS
SELECT ISNULL( product, 'O') product,...
March 12, 2015 at 4:38 pm
What do you mean by being used?
In that precise moment? In the last days? That have data? That are included in stored procedures, functions or views?
March 12, 2015 at 4:13 pm
I'm sure your code can get many improvements. Could you post some sample data and DDL to be able to test?
March 12, 2015 at 3:22 pm
Have you checked the execution plans with both compatibility levels? You should be getting different plans.
Table variables don't have statistics and the optimizer always treats them as if they have...
March 12, 2015 at 3:08 pm
Try this:
DECLARE @ColumnName2 NVARCHAR(MAX)='East,Central,West';
SET @ColumnName2 = REPLACE(@ColumnName2, ',', '],[');
SELECT @ColumnName2
March 12, 2015 at 12:22 pm
Why aren't you parametrizing your dynamic query?
Your column list for the pivot is wrong. You set it like this:
DECLARE @ColumnName2 NVARCHAR(MAX)='East,Central,West';
And use it in here:
PIVOT(
...
March 12, 2015 at 12:16 pm
This is an option. I'm using CROSS APPLY to reduce code at the formulas. 😉
SELECT EmailAddr,
Fullname,
LEFT(Fullname, CHARINDEX('.', Fullname) - 1) FirstName,
...
March 12, 2015 at 12:01 pm
You're describing 3 datasets, which is a terrible idea as you'll have problems managing them.
Instead, you need a single dataset that can be formatted in the presentation layer which I...
March 12, 2015 at 11:14 am
Note that if you format your date it won't be a date any more and it will be a string. String dates will give you problems if you try to...
March 12, 2015 at 10:14 am
I'm sure I've been bitten by this issue before, but I'm trying to replicate it without success.
Maybe it has something to do with this:
From BOL
The size of the string is...
March 12, 2015 at 10:06 am
Viewing 15 posts - 5,116 through 5,130 (of 8,731 total)