Viewing 15 posts - 58,546 through 58,560 (of 59,099 total)
Ryan, You are correct. It doesn't work correctly for 3.445657545.
It rounds to 3.44 instead of 3.45 as you stated. Thanks for the catch...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 28, 2005 at 9:18 am
An interesting mix of delight and pain... sort of like sweet-and-sour sauce with a generous dose of horse-radish... and I love horse-radish!
And thanks for all you do behind the scenes,...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 27, 2005 at 9:20 pm
Andrew... This also works... and, it's set based.... just substitute a column name for @Number in the formula...
-- Math.Round(3.454,2) -> 3.45
-- Math.Round(3.455,2) -> 3.46
-- Math.Round(3.445,2) -> 3.44
-- Math.Round(3.456,2)...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 27, 2005 at 11:10 am
If you mean round to the nearest whole number, then simply converting to INT will do...
DECLARE @Amount1 MONEY
SET @Amount1 = 7.49
DECLARE @Amount2 MONEY
SET @Amount2 = 7.50
DECLARE...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 25, 2005 at 9:45 pm
You bet... Merry Christmas.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 25, 2005 at 9:25 pm
You are new at this...
Try this, Josh...
UPDATE yourtable
SET Name = RTRIM(SUBSTRING(Subject,1,CHARINDEX('#',Subject,1)-1)),
Paid = RTRIM(SUBSTRING(Subject,CHARINDEX('#',Subject,1),
CHARINDEX('$',Subject,1)-CHARINDEX('#',Subject,1))),
Amount = RTRIM(SUBSTRING(Subject,CHARINDEX('$',Subject,1),
CHARINDEX('/',Subject,1)-CHARINDEX('$',Subject,1))),
CheckNo = RTRIM(SUBSTRING(Subject,CHARINDEX('/',Subject,1)+1,999))
FROM yourtable
And, let's hope...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 25, 2005 at 7:13 am
I'm thinking... REFRESH, REFRESH, REFRESH again.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 24, 2005 at 12:35 pm
Assuming that the column you are parsing is called "ParseThis" and your table name is called "yourtable", this will work PROVIDED that you always have all 4 parts...
SELECT...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 24, 2005 at 12:31 pm
No, but I'm thinking that this is "Death by SQL" of the same magnitude as disabling the automatic recalculation of statistics.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 24, 2005 at 12:08 pm
"Books Online" describes both FLOAT and REAL as follows:
"Approximate number data types for use with floating point numeric data. Floating point data is approximate; not all values in the data...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 24, 2005 at 12:04 pm
If your job only runs on Saturday, then you've done it the most efficient way.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 24, 2005 at 11:52 am
Carl, sometimes there's just no application to be had... SQL is it.
Mark, the reason you are getting the error is that you must either have SA permissions or your DBA...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 22, 2005 at 12:41 am
Very cool, jratwork... I have a similar un-natural aversion to correlated subqueries and I had my doubts when I saw the "<" in the correlated subquery... but I just ran...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 20, 2005 at 5:18 pm
First, this isn't a DB2 forum and not all SQL's are created equal. That, notwithstanding, you say "it didn't work"... if you got an error message, is sure would be...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 19, 2005 at 11:10 pm
"Online AnonProfile" seems a bit paranoid as a "handle" to me
... whatever...
This little ditty should help you in your quest for primary...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 19, 2005 at 10:59 pm
Viewing 15 posts - 58,546 through 58,560 (of 59,099 total)