Viewing 15 posts - 55,756 through 55,770 (of 59,072 total)
SELECT CAST(CONVERT(CHAR(8),somedate,112) AS INT)
...but it's an insane thing to do for so many reasons...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 5:52 pm
Almost forgot to ask... I know you said you can't normalize the table (would be the greatest space saver of them all here) so I won't bug you about that... but...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 5:46 pm
Using LTRIM(RTRIM()) will not make NULLs... that may be a part of the problem... here's the proof...
DECLARE @NullOrBlank VARCHAR(8000)
SELECT @NullOrBlank = REPLICATE(' ',100)
SELECT DATALENGTH(@NullOrBlank) AS DataLengthBefore,
...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 5:44 pm
It wouldn't be a "sum"... it would still be a COUNT except it wouldn't be DISTINCT. And, because you are not counting DISTINCT LID's, you already have the sum of...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 5:30 pm
Michael,
Why don't you write an article here on SQLServerCentral about you number and date range generator functions? I've always been really impressed with the speed of the darned things...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 5:22 pm
Oh, yeah... if you want the actual "Region ID", you'll need to get Telcordia's "NNACL"... but I think that's only for the US and Canada. Prepare to pay some $$...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 3:41 pm
I'll second that on LincMad... been using his stuff for years and is one of the best places to find this type of free info.
If you need something to pay...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 3:38 pm
Heh... also hacked one for Peter's method... slowed it down just a bit but it's still faster than the traditional method...
--===== Peter's method of generating random numbers from...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 3:26 pm
Hacked a fix for the zero distribution problem on the traditional method...
--===== Traditional method of generating random numbers from -5 to +5
SELECT SUM(CASE WHEN r = -5...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 3:16 pm
Couldn't resist... simple integer rounding gives zero twice the number of hits using both methods... everything else has a pretty good distirubtion... if anyone wants to take a crack at...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 3:03 pm
Peter, I gotta say it again... nice job... I was a bit concerned about distribution of the numbers so I compared your method against the traditional method... both have the...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 2:52 pm
Heh... no problem James... short naps are what get me through the day ![]()
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 2:29 pm
Percent James... he needs the /100 to turn it into the decimal equivelent of percent so it can be used as a multiplier...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 2:12 pm
Close Peter... and nicely done, but I believe you need this instead...
SELECT 1 + (CHECKSUM(NEWID()) % 6) / 100.0
...yours gave a range of .96 to 1.04... above gives range of .95...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 2:10 pm
Heh... look at the original post... no need to put these in startup (although that's a good idea!).
--Jeff Moden
Change is inevitable... Change for the better is not.
July 17, 2007 at 11:08 am
Viewing 15 posts - 55,756 through 55,770 (of 59,072 total)