Viewing 15 posts - 3,541 through 3,555 (of 4,087 total)
There's another approach that edges out the CROSS APPLY approach. Depending on your indexes, this approach might be better.
PARTITIONED AGGREGATE
WITH OrdersRanked AS (
SELECT [CustomerID],ShipVia
, Sum(Freight) OVER( PARTITION BY CustomerID...
October 19, 2011 at 10:01 am
Lowell (10/18/2011)
October 18, 2011 at 3:19 pm
I was able to get it to work with the following:
SELECT @Text = Replace(@Text COLLATE LATIN1_GENERAL_BIN, Symbol, HTML)
FROM @Symbols
WHERE PatIndex('%' + Symbol + '%', @Text) > 0
October 18, 2011 at 2:44 pm
toddasd (10/18/2011)
OP, if you want the extra non-matches to not show, thrown a WHERE n.Name IS NOT NULL
AND s.Code IS NOT NULL; to the end...
October 18, 2011 at 12:48 pm
This is actually much simpler than it seems, because SELECT is implemented behind the scenes as a loop. Jeff Moden refers to this as a pseudo-cursor. You can...
October 18, 2011 at 12:34 pm
This is actually quite easy. You need to order each of the tables separately and then join the two tables both on the segmentID and the order. I...
October 18, 2011 at 11:33 am
irobertson (10/18/2011)
So, I still don't beat the case statement. But I had fun, so that's all that matters 🙂
Actually, the CASE version isn't even completely optimized. It's doing a...
October 18, 2011 at 10:16 am
You have two options. Which one works best will depend on a number of factors such as what indexes you have/create and how selective those indexes are.
Option 1: CTE...
October 18, 2011 at 9:35 am
Jeff Moden has a very good article on exactly this type of problem.
Solving the Running Total and Ordinal Rank Problems (Rewritten)[/url]
Drew
October 18, 2011 at 8:15 am
DELETEs are fully logged, and you're trying to delete 10 million rows IN ONE TRANSACTION. You need to break this up into more manageable pieces. You can use...
October 18, 2011 at 7:13 am
The most efficient way to do this is to use the correct tool for the job. That tool is a reporting tool (such as SSRS). T-SQL is most...
October 17, 2011 at 2:39 pm
This is a presentation issue, and is best done in the presentation layer. You don't mention what you are using for your presentation layer, so we can't give you...
October 17, 2011 at 9:14 am
vick12 (10/13/2011)
create stored procedure testsorting
( @sort varchar(60)
)
as
BEGIN
SELECT...
October 14, 2011 at 9:16 am
Lynn Pettis (10/13/2011)
Post your code? You may find this solution works better. Always worth investigating.
I didn't save the code.
Drew
October 13, 2011 at 11:32 am
Junglee_George (10/13/2011)
Which one of the following is preferred considering the performance of the SQL query executed..??
Actually, neither one is preferred. The first one is worst--as has already been mentioned--because...
October 13, 2011 at 8:09 am
Viewing 15 posts - 3,541 through 3,555 (of 4,087 total)