Viewing 15 posts - 406 through 420 (of 1,295 total)
It's algebra which could be directly calculated, no?
1555201/2^x=800
2^x=1555201/800
log10(2^x)=log10(1555201/800)
x = log10(1555201/800) / log10(2)
x=10.92481343
The number of times it would need to be "applied" before it crossed the 800 barrier would be the...
October 27, 2021 at 4:11 pm
I am working on a job shortage report that first consumes inventory and then works through job supply one job at a time. The query is using sum over...
October 27, 2021 at 12:01 pm
What about those flying cars? Your code converts the 'NumericValue' column into VARCHAR(10) which is only ok as long as the integer is positive. My code converted to VARCHAR(20) because...
October 25, 2021 at 9:52 pm
What about a potential negative sign? You gonna add a phony replacement in for that too?
Good idea! Yes, I added ('-', '-') and it works with negative integers now...
October 25, 2021 at 7:07 pm
To review, the table definition provided by the OP
CREATE TABLE dbo.IntChange (NumericValue INT)
INSERT INTO dbo.IntChange
VALUES (15697)
,(876)
,(1452)
,(3374)
,(894)
,(84516)
You have some reason to believe the future universe of possible inputs...
October 25, 2021 at 6:52 pm
Wow all that. Ok maybe something like this
select IcC.NumericValue,
stuff((select ''+v.repl
...
October 25, 2021 at 6:24 pm
You feel misled? It's an axiomatic statement of equivalency
October 25, 2021 at 5:30 pm
Your code also has zeros just disappear completely from your results. It's never explicitly stated that zeros can't appear in these numbers. Just in case they do, I think...
October 25, 2021 at 4:44 pm
Is that code fundamentally different than the first query I posted using the same method?
No temp table
No Cartesian product without row goal, i.e. SELECT TOP(n)
No LEFT JOIN
No ISNULL
October 25, 2021 at 3:51 pm
Sorry it's not clear to me. Maybe a more detailed example could help
October 24, 2021 at 5:57 pm
What are the expected Usage and Result values for each row of the @t table?
October 24, 2021 at 4:40 pm
maybe something like this
select ic.NumericValue,
stuff((select '' + v.repl
...
October 24, 2021 at 12:59 pm
The REPLACE method maybe is not appropriate here but I still would like to know how that works. Anyway, given this is version 2016 maybe something like this
October 23, 2021 at 4:29 pm
Hold a sec, the code above is making multiple replacements of the same character. 7 replaces 1 then 5 replaces 7. The reason seems to be because the order of...
October 23, 2021 at 2:20 pm
This is one of those gray areas... or idk maybe someone can explain why this actually works. For reasons unknown, afaik when the REPLACE function is used in the righthand...
October 23, 2021 at 12:21 pm
Viewing 15 posts - 406 through 420 (of 1,295 total)