Forum Replies Created

Viewing 15 posts - 31 through 45 (of 68 total)

  • RE: Faster way to INSERT INTO large table

    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]...

  • RE: Faster way to INSERT INTO large table

    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...

  • RE: Faster way to INSERT INTO large table

    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...

  • RE: Checking my work

    Thank you for the suggestions. Now the goal is to actually implement them. Sounds so easy... 🙂

  • RE: Non-aggregated in aggregate function

    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...

  • RE: Non-aggregated in aggregate function

    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...

  • RE: Non-aggregated in aggregate function

    Ninja's_RGR'us (10/19/2011)


    Apparently it's also too long to post the full question!

    I got it out eventually. 🙂

  • RE: Non-aggregated in aggregate function

    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...

  • RE: Cummulative percents

    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...

  • RE: Cummulative percents

    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,...

  • RE: Cummulative percents

    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...

  • RE: Only integers

    Ah, the CAST vs. CONVERT debate finally gets personal. Well played, Lowell. 😀

  • RE: Only integers

    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...

  • RE: SET @SQL = ...

    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...

  • RE: Removing one letter from a string

    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...

Viewing 15 posts - 31 through 45 (of 68 total)