Viewing 15 posts - 6,601 through 6,615 (of 8,731 total)
You can't use IIF unless you use 2012. For 2008 and previous versions, you need to use a (nested) CASE.
April 3, 2014 at 4:12 pm
You have 2 options:
First one:
WITH CTE AS(
select case atr.Race
when 32 then 'White'
when 1 then 'Black/African American'
when 2 then 'Asian'
when 4 then 'American Indian/Alaskan Native'
when 16 then 'American Indian/Alaskan Native'
when 8...
April 3, 2014 at 3:40 pm
Eirikur Eiriksson (4/3/2014)
Straight forward using Window functions
Isn't that over complicating something that could be achieved like this?
SELECT PONum
,POLineNum
,POSublineNum
,MIN(SublineInstance)...
April 3, 2014 at 1:41 pm
You don't need several CASE, one is enough.
Case when Status = 'Yes' then 'WithinStatus'
when Hours< Benchmark Then 'OutsideStatus'
Else 'WithinStatus'
End as StatusType.
If a...
April 3, 2014 at 1:24 pm
I always forget to use the nested replace solutions. It should outperform the splitter.
I wish that SQL Server could include a "pattern replace" to get something like
SELECT LTRIM( PATREPLACE(...
April 3, 2014 at 1:05 pm
Try using MIN() and group by PONum, POLineNum & POSublineNum.
April 3, 2014 at 10:51 am
The problem with your loop (other than being a loop:-P) is that you didn't initialize the @output variable. You're adding values to NULL and that's giving you NULL. If you...
April 3, 2014 at 9:52 am
And if you need them as bit values:
WITH SampleData AS(
SELECT 55 Value UNION ALL
SELECT 63 UNION ALL
SELECT 26
)
SELECT Value,
CAST(Value & 64 AS bit) AS Sat,
...
April 3, 2014 at 9:47 am
Simplifying Rodders code if digits will only appear at the beginning of the string.
CREATE TABLE #Names(
[Name] [varchar](200) NULL
)
INSERT INTO #NAMES
VALUES ('22rajuvar'),
('45 vamsgui'),
('87 praveen'),
('67kumar'),
('32 vamshi'),
('123aaa'),('abcd'),('abc123'),('ab56def'),('xyz'),('9999'),('3946'),('9236'),('854')
SELECT STUFF(NAME, 1, PATINDEX('%[a-zA-Z]%', NAME) -...
April 3, 2014 at 9:36 am
Do you need something like this?
WITH SampleData AS(
SELECT 55 Value UNION ALL
SELECT 63 UNION ALL
SELECT 26
)
SELECT Value,
(Value & 64) / 64AS Sat,
(Value & 32) / 32AS Fri,
(Value &...
April 2, 2014 at 6:48 pm
If you post your cursor solution, we could help you to convert it to a set based solution. It will run a lot faster if done properly and will change...
April 2, 2014 at 6:41 pm
I got lost with your last post. Do you mean that you really need to show all the possible values in the gap so they're available in a chart?
If you...
April 2, 2014 at 6:17 pm
To avoid those search problems once you've found something interesting, I would suggest to use the bookmarks on your browser (Chrome will synchronize them within all your devices) or the...
April 2, 2014 at 6:05 pm
First of all, you should provide sample data in a consumable form if you want to get better and faster answers. I did it for you this time because you're...
April 2, 2014 at 6:01 pm
Viewing 15 posts - 6,601 through 6,615 (of 8,731 total)