Viewing 15 posts - 58,576 through 58,590 (of 59,053 total)
Can do...
SELECT FieldID,
MIN(CASE WHEN FieldName = 'NAME' THEN FieldValue END) AS NAME,
MIN(CASE WHEN FieldName = 'Address' THEN FieldValue END) AS Address,
MIN(CASE WHEN FieldName = 'ZIP' ...
November 24, 2005 at 1:31 am
One more thing! Don't even think of using the SELECT/INTO/RENAME method if others are updating the table at the same time or inserting new rows.... YOU WILL LOSE...
November 20, 2005 at 10:51 am
Almost forgot... does the table being updated have any triggers? That really make things slow for this big an update especially if those triggers are writing to audit tables or...
November 20, 2005 at 10:41 am
Yup, I'd lose the OUTER JOIN if an INNER JOIN will do. Also, like someone else asked, "What is slow"? I normally shoot for about 500,000 rows per minute (sometimes...
November 20, 2005 at 10:38 am
Very, very cool... ol' Itzik did a neat job on this one.
Ken, do you know of a fn_DecToBase function in a similar vein by anyone?
November 19, 2005 at 7:51 am
Get the list of database names from Master.dbo.SysDataBases... build your own loop or (yeeach!) cursor to step the the DB names or ID's as the outer nest for sp_MSForEachTable.
November 19, 2005 at 7:07 am
Brilliant use of recursion guys! Absolutely awesome.
November 18, 2005 at 7:38 pm
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...
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...
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...
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...
November 15, 2005 at 9:55 pm
Roger that... I'll put mine in a UDF
Thanks for the tip on the deterministic thing.
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...
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...
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)
November 14, 2005 at 10:07 pm
Viewing 15 posts - 58,576 through 58,590 (of 59,053 total)