Viewing 15 posts - 58,621 through 58,635 (of 59,091 total)
Take a look at the SQL portion of w3schools.com. It won't teach you all of the nuances of MS-SQL Server but it will give you a nice comfortable start on...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 18, 2005 at 6:12 pm
The original requester pointed out the he wanted to do it without a cursor. As David pointed out, the underlying code for sp_MSForEachTable and other similar routines are riddled with...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 18, 2005 at 6:09 pm
The "INTO" clause of SELECT/INTO creates the temp table on the fly.
You are correct about COALESCE... It does the work... you could replace it with ISNULL and the effect...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 15, 2005 at 10:49 pm
As Kenneth suggested, ISNUMERIC may not cut it. It allows for seemingly non-numeric characters such as "d", "e", and "." so that it will support scientific and exponential notation. Continuing Sushila's...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 15, 2005 at 9:55 pm
Roger that... I'll put mine in a UDF
Thanks for the tip on the deterministic thing.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 15, 2005 at 9:40 pm
________________________________________________________________________________________________________________________
Does NOT require TimeIn/TimeOut be on same day... only requires that for every TimeIn, there is a TimeOut and that there are no "straggler" TimeOut's from the previous...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 15, 2005 at 9:36 pm
--===== Create a function to concatenate orders by customer
CREATE FUNCTION dbo.ConcatOrderNum (@pCustomerID AS INT)
RETURNS VARCHAR(8000)
AS
BEGIN
DECLARE @oResult VARCHAR(8000)
SELECT @oResult= COALESCE(@oResult+',','')+OrderNumber
FROM Customer_Orders WITH (NOLOCK)
WHERE CustomerID...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 15, 2005 at 8:54 pm
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
Viewing 15 posts - 58,621 through 58,635 (of 59,091 total)