Viewing 15 posts - 2,431 through 2,445 (of 4,085 total)
Why aren't the last buys from 2016-08-18 17:38:40.000 and 2016-08-17 15:03:52.000?
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 23, 2016 at 9:54 am
Francis Twomey (8/22/2016)
INSERT INTO item_relation_table
(parent__id,
child__id,
relation)
SELECT xm.1_id, xm.2_ID,
'A',
from tablexm xm
where xm.1_id != xm.2_ID and
exists(select 1 from item ip WHERE ip.mfg =...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 3:45 pm
Depending on what your statuses are, you may not even need a case expression. If your only statuses are ADD and DISCHARGE, then you can just use MAX(status) <...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 3:31 pm
Jacob Wilkins (8/22/2016)
drew.allen (8/22/2016)
COUNT(CASE WHEN...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 3:21 pm
COUNT will work as an aggregate if you return a NULL in the proper cases. COUNT() may not perform the best, but it will work.
COUNT(CASE WHEN status='Discharge' THEN 1...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 1:24 pm
You should post what you've already tried. It's going to be easier for you to understand if it's just a minor change in your existing code rather than having...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 1:14 pm
Jacob Wilkins (8/22/2016)
Something like this:
[column] LIKE '['+@a+'-'+@b+']%'Cheers!
This will only work if you pass in single characters as your parameters. Given that you've defined your parameters as VARCHAR(50), it seems...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 12:00 pm
And if you're looking for a range of values between the two parameters, it becomes a bit tricky. For instance, if your parameter values are 'A' and 'C', you'll...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 11:51 am
WayneS (8/22/2016)
drew.allen (8/17/2016)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 9:27 am
mister.magoo (8/21/2016)
WITH CTE AS
(
SELECT
seq
, ROW_NUMBER() OVER
(
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 22, 2016 at 8:44 am
This will also work.
UPDATE #test
SET Flag = @Flag
WHERE Id = @Id
AND COALESCE(Flag, ~@Flag, 0) <> COALESCE(@Flag,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 19, 2016 at 8:13 am
ChrisM@Work (8/19/2016)
UPDATE #test
SET Flag = @Flag
WHERE Id =...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 19, 2016 at 7:45 am
I like the following method, particularly when you are comparing multiple columns.
UPDATE #test
SET Flag = @Flag
CROSS APPLY (
SELECT Flag
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 19, 2016 at 7:35 am
This is even in the Microsoft documentation.
Using decimal, float, and real Data
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 18, 2016 at 4:20 pm
Sorry, I didn't realize that you were on SQL 2005. You need SQL 2012 to use this construct. I should pay more attention to which forum I'm in.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 18, 2016 at 2:53 pm
Viewing 15 posts - 2,431 through 2,445 (of 4,085 total)