Viewing 15 posts - 31 through 45 (of 1,155 total)
I agree with Joe that this should be done in the presentation/application layer. I understand that sometimes this is beyond your control. If you absolutely must accomplish this...
July 21, 2010 at 12:09 pm
No need for a computer column here. You should use the like operator.
DECLARE @t TABLE(
col VARCHAR(10)
);
INSERT INTO @t VALUES ('13abc');
INSERT INTO @t VALUES ('1abcde');
SELECT *
FROM @t
where col NOT LIKE...
July 21, 2010 at 12:04 pm
Something like this should work.
DECLARE @T TABLE (ModifiedDate DATETIME, Ignition BIT)
INSERT INTO @t (modifieddate,Ignition)
SELECT '2010-07-05 13:36:24.470', 0
UNION ALL
SELECT '2010-07-05 13:37:28.513', 0
UNION ALL
SELECT '2010-07-05 13:38:33.560' ,1
UNION ALL
SELECT '2010-07-05...
July 13, 2010 at 1:55 pm
There should be no difference in performance because the plans should be the same. The plans should be the same because the optimizer is smart enough to only output...
July 13, 2010 at 12:50 pm
This is a pretty straight forward request. You only need to use the right function to pad the string.
DECLARE @t TABLE(Id INT);
INSERT INTO @t VALUES(1);
INSERT INTO @t VALUES(10);
INSERT INTO...
July 13, 2010 at 12:44 pm
Correct, so my assumption is the code has some control flow logic checks that make the loop exit early if NULL values are detected, but it doesnt make sense to...
July 12, 2010 at 2:50 pm
I personally think the reason the function returns null is because of NULL concatenation math. I think the underlying code uses loops and concatentates the string piece by piece...
July 12, 2010 at 1:09 pm
GabyYYZ (12/24/2008)
The while loop I used was only a proof of concept, and was designed to show people the mechanics of breaking out of a cursor mindset. They are...
June 18, 2010 at 7:06 am
noeld (5/24/2010)
johan.lindell (5/24/2010)
From a performance perspective, using NOT IN is "always" slower than using EXISTS. If you try running the below queries
-- INTERSECT
SELECT CustomerID
FROM Sales.Customer
WHERE TerritoryID=10
AND NOT...
May 25, 2010 at 7:39 am
I think it is also important to understand what is going on underneath the hood, when NULLIF is used. Unbeknownst to some, NULLIF is actually a case expression under the...
May 3, 2010 at 11:08 am
Another solution is to use date math.
DECLARE @dt DATETIME,
@Day_Start SMALLINT
SET @Day_Start = 0--0=Sun,1=Mon,2=Tue,3=Wed,4=Thu,5=Fri,6=Sat
SET @dt = '20091219'
SELECT
--Day Of Week formula:
--datediff of @Day_Start (this...
February 19, 2010 at 11:37 am
Great Job Jonathan! I look forward to part 2.
December 23, 2009 at 11:24 am
Jeff Moden (12/14/2009)
Aaron Gonzalez-394690 (12/14/2009)
I was involved in a similar situation before and since we were working with sql server 2005 I had the developer pass a...
December 14, 2009 at 11:22 am
You have to add the noexpand hint to the query to use the view's index. The noexpand hint forces the optimizer to use the views data instead of the...
December 8, 2009 at 4:06 pm
Viewing 15 posts - 31 through 45 (of 1,155 total)