Viewing 15 posts - 31 through 45 (of 68 total)
OK, the actual code:
This is the table the records need to go into
CREATE TABLE [dbo].[BED_MN](
[stfips] [char](2) NOT NULL,
[areatype] [char](2) NOT NULL,
[char](6) NOT NULL,
[periodyear] [char](4) NOT NULL,
[periodtype] [char](2) NOT NULL,
[period]...
November 21, 2011 at 1:54 pm
OK, yes, you have a point that I should be paying much more attention to the indexes on a table and utilizing them. With that in mind, I want to...
November 21, 2011 at 1:38 pm
Lowell, If you want the actual execution plan, you'll have to wait quite a while. There are two indexes on the insert into table (PK clustereed and non-unique, non-clustered) and...
November 21, 2011 at 12:18 pm
Thank you for the suggestions. Now the goal is to actually implement them. Sounds so easy... 🙂
November 2, 2011 at 10:21 am
drew.allen (10/19/2011)
Sum(Freight) OVER( PARTITION BY CustomerID ) AS FreightTotal
I feel silly to admit this, but I had no idea you could do a sum function like this. This opens...
October 19, 2011 at 10:11 am
Well, this is what I came up with (I tend to have flashes of inspiration immediately after posting) --
SELECT o.[CustomerID], ShipVia, Freight, y.Cost
FROM [Northwind].[dbo].[Orders] o
join
(SELECT customerid, MAX(freight) fr1 --Largest freight...
October 19, 2011 at 9:27 am
Ninja's_RGR'us (10/19/2011)
Apparently it's also too long to post the full question!
I got it out eventually. 🙂
October 19, 2011 at 9:15 am
Oops, posted that too early. Anyway, as I was saying, in the Northwind.Orders table I would like to sum the Freight column but CustomerID. I would also like the ShipVia...
October 19, 2011 at 9:13 am
I did see the changes, and hopefully incorporated them. I should go back and read it again though; I was so excited it worked, but realize I don't fully understand...
October 19, 2011 at 8:37 am
Read the article and re-wrote the code. I now know I was trying to do a "triangular join". The performance went from nearly a full day (it never did finish,...
October 18, 2011 at 12:29 pm
bitbucket-25253 (10/18/2011)
Test your code, with this variation. Instead of using a TABLE VARIABLE (@Table) use a Temp Table (#Table)
Ron, That code is just for example on the forum. The...
October 18, 2011 at 8:01 am
Ah, the CAST vs. CONVERT debate finally gets personal. Well played, Lowell. 😀
October 14, 2011 at 1:45 pm
I actually just figured it out. If anyone is curious, here it is:
SELECT cast(var1 as int) as var1
from table
GROUP BY cast(var1 as int)
101 rows, just like I wanted. I'm...
October 14, 2011 at 1:32 pm
Thank you all. I am making my way through the article toddasd posted and learning a lot. So for the time being, this topic can be concidered resolved.
Note: I...
September 27, 2011 at 7:58 am
Even though Ninja's_RGR'us solution should have worked, this is what ended up doing the trick --
Case when RIGHT(rtrim(f3),1) = 'T' then LEFT( f3, LEN(f3)-1) else f3 end
I would ponder...
September 22, 2011 at 9:41 am
Viewing 15 posts - 31 through 45 (of 68 total)