Viewing 15 posts - 58,636 through 58,650 (of 59,099 total)
Serqiy,
This too, is deterministic and a bit easier on the eyes...
RIGHT('000'+CAST(XID%1000 AS VARCHAR),3)
--Jeff Moden
Change is inevitable... Change for the better is not.
November 14, 2005 at 10:07 pm
Just curious, Serqiy... why do you prefer the following...
+convert(char(3), replicate('0', 3-len(convert(varchar(3), XID%1000))) + convert(varchar(3), XID%1000)), --The 3 digit numeric part
... over ...
+REPLACE(STR(XID%1000,3),' ','0'), --The 3 digit numeric part
--Jeff Moden
Change is inevitable... Change for the better is not.
November 14, 2005 at 6:24 am
>the only reason I mentioned 'INSTEAD OF' trigger ...
Got it... thanks for the idea, David.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 14, 2005 at 6:21 am
Cool... thanks for posting back to save us time.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 13, 2005 at 9:43 am
I absolutely agree... especially when they nest such views... ![]()
--Jeff Moden
Change is inevitable... Change for the better is not.
November 12, 2005 at 10:14 pm
Thanks for the kudo, David. It's a real pleasure to hear coming from you.
Lowell's idea is a good one... You very well could use the calculation as a computed column.......
--Jeff Moden
Change is inevitable... Change for the better is not.
November 12, 2005 at 8:18 am
Brian,
David is on the right track with a function but, here's some simpler code that uses classic "base" conversion techniques... it may be just a bit faster because it's 100%...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 11, 2005 at 7:08 am
SELECT NEWID()
Use substring to get a piece if you want.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 10, 2005 at 10:30 pm
Ami,
I didn't take the time to convert this to your table or column names. If you are using INT for your ID's, it's good to 727 levels... usually more than...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 10, 2005 at 10:28 pm
First, I'd have to ask why do you need a more definitive answer? The simple truth of the matter is that's the way they made it and none of us...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 10, 2005 at 10:11 pm
![]()
--Jeff Moden
Change is inevitable... Change for the better is not.
November 5, 2005 at 10:27 am
Farrell,
You didn't read far enough down where I said "Adam Mechanic would probably remind you about the need for auxilary calendar tables or at least a numbers table...". Or were...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 4, 2005 at 7:54 pm
Dunno about all the DST and GMT stuff, but here's a way to find the last Saturday of a month given any date in that month... since it includes time,...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 2, 2005 at 10:00 pm
This works...
SELECT CAST(YYYY+MM+DD AS SMALLDATETIME)
The reason why it works is because yyyymmdd is one of the (ISO) recognized datetime formats... no need for the slashes or anything...
--Jeff Moden
Change is inevitable... Change for the better is not.
October 31, 2005 at 10:30 pm
I can't take the credit for the following but it does the job for me....
"Normalize 'till it hurts... Denormalize 'till it works."
--Jeff Moden
Change is inevitable... Change for the better is not.
October 31, 2005 at 10:27 pm
Viewing 15 posts - 58,636 through 58,650 (of 59,099 total)