Viewing 15 posts - 181 through 195 (of 311 total)
As an alternative to a CASE expression, you can use the SIGN function:
select column1, SIGN(column1) * POWER (abs(column1), 1.8) * CAST(10000 as float) from #t
March 5, 2010 at 8:55 am
It runs without any error, but what does it mean? Second, CAST(10000 as float) is equivalent to 10000. (with a dot).
Peter
March 5, 2010 at 8:48 am
Thanks Lynn, it's a long time ago I opened a math book but that's what I remembered from it. I'm curious what the OP tries to compute.
Peter
March 5, 2010 at 8:34 am
I don't know what you are trying to compute, but there's no workaround for this simply because it's mathematically undefined. You can't raise a negative number to power which is...
March 5, 2010 at 8:18 am
Glad we could help. Thanks for the feedback.
Peter
March 5, 2010 at 7:19 am
Chris' solution returns 9 rows because it only take 3 date points into account, the same as your original query. My solution returns 12 rows because it take 138 (3...
March 5, 2010 at 6:55 am
Do you mean you have 140 almost identical query's UNIONed together? Try this one:
SELECT
Registration_ID, [Person_ID], Start_Date_Registration,
J.Duration, A.[Date Point]
FROM
dbo.Test_Registrations
CROSS JOIN
(
SELECT...
March 5, 2010 at 6:21 am
Here's an example with @i <= 65536
declare @i int = 65536;
with
Tally4(N) as (select 1 union all select 1 union all select 1 union all select 1) ,
...
March 5, 2010 at 4:30 am
Yep, actually it goes wrong when @i > 2048. spt_values contains numbers from 0 to 2047. If @i can be greater than that in your situation then you have to...
March 5, 2010 at 3:57 am
Apart from the order of the result, I don't see what's wrong with your own solution. If you want the result in the order you specified in your example try...
March 5, 2010 at 3:22 am
Peter Brinkhaus (3/4/2010)
March 4, 2010 at 5:05 am
As an alternative for those not using SQL Server 2008 SP1 CU5 or working with SQL Server 2005, you can duplicate the query each with a different condition and UNION...
March 4, 2010 at 3:31 am
Maybe this one?
SELECT
CASE
WHEN A.K IS NULL AND EXISTS (SELECT * FROM A WHERE A.K = B.K) THEN
...
March 2, 2010 at 6:00 am
I have performed the test too with similar results. All solutions benefit from an index on columns Section and DT. Paul's solution benefits the most from the index and becomes...
February 26, 2010 at 10:03 am
Be careful. Depending on the collation being used you can get very odd results when comparing characters. For instance, I am using collation Latin1_General_CI_AS and the insertions into table Replace_Lookup...
February 26, 2010 at 3:26 am
Viewing 15 posts - 181 through 195 (of 311 total)