Viewing 15 posts - 361 through 375 (of 748 total)
Lowell (12/8/2011)
if the role is going to have EXECUTE priviledges on all procs, without exception, i think you can simply...
December 8, 2011 at 9:25 am
Lynn Pettis (12/6/2011)
Ninja - You'll have to show me what you were trying to accomplish, just not clicking today.
Please don't be tough to Ninja, maybe it was a tough day...
December 7, 2011 at 9:26 am
Lynn Pettis (12/6/2011)
Here is another way to write my query, just requires more typing:
select
...
December 7, 2011 at 9:23 am
Ninja's_RGR'us (12/6/2011)
No, use a single @start and @end and use then only once in the where.Time for coffee :hehe:.
Can't deliver coffee to Montreal from Toronto, TH does not provide that...
December 6, 2011 at 12:16 pm
Do you think this is correct?
where org.Business_Line = @BL and
1 = CASE WHEN @Due = 1 AND NextReviewDate between @start1 and @end1 THEN 1
WHEN @Due = 2 AND NextReviewDate...
December 6, 2011 at 11:59 am
Ninja's_RGR'us (12/6/2011)
Do your cases first to set the range then use between in the select.
If you insist on the where (making it non sargable)
AND 1 = CASE...
December 6, 2011 at 11:45 am
I figured it out:
All I need to do is to define parameters for the sp_executesql
Here is the working code:
.........
EXEC sp_executesql
@sql,
...
December 5, 2011 at 11:50 am
From the error message it seems that sp_executesql must take parameters with the type of 'ntext/nchar/nvarchar' only, so I modified the sp again as following:
......
declare @NewTimeLine nvarchar(3)
declare @NewConsultant nvarchar(3)
set @NewTimeLine...
December 5, 2011 at 11:40 am
Gianluca Sartori (12/5/2011)
I suspect that you didn't change @sql to datatype nvarchar.
Actually I did.
ALTER Proc [dbo].[spGetStatisticByCategoryBLTimeLineConsultant](@Type varchar(50),@BL varchar(255), @TimeLine int, @Consultant int)
AS
declare @param datetime
SET @param =
CASE
WHEN @timeline...
December 5, 2011 at 10:50 am
Gianluca Sartori (12/5/2011)
ALTER Proc [dbo].[spGetStatisticByCategoryBLTimeLineConsultant](@Type varchar(50),@BL varchar(255), @TimeLine int, @Consultant int)
AS
DECLARE @param datetime
SET @param =
CASE
WHEN @timeline = 0 THEN DATEADD(yy,-100,getdate())...
December 5, 2011 at 10:01 am
Thanks all responds, the final version is here:
select BL = ISNULL(NULLIF(Business_Line, ''), 'Others')
FROM Isc_OrgUnits
Group By Business_Line
ORDER BY
CASE
WHEN len(Business_Line)>0
...
November 30, 2011 at 9:13 am
Sean Lange (11/30/2011)
Lowell, Gus and I all gave you an example of how to do that.
order by case when...
I know, I tried to adopt it like here, it doesn't...
November 30, 2011 at 7:35 am
GSquared (11/30/2011)
ISNULL(NULLIF(Business_Line, ''), 'Others')
That will take a blank and turn it into a Null, and then run the ISNULL on it. If...
November 30, 2011 at 7:16 am
In stead of using so many "case" in the select, I found this query is more elegant:
SELECT distinct ISNULL(Business_Line, 'Others')
FROM Org
ORDER BY ISNULL(Business_Line, 'Others')
The problem...
November 29, 2011 at 12:51 pm
Lowell (11/29/2011)
SELECT BL = CASE
WHEN Business_Line IS NULL
...
November 29, 2011 at 12:26 pm
Viewing 15 posts - 361 through 375 (of 748 total)