Forum Replies Created

Viewing 15 posts - 1,021 through 1,035 (of 4,081 total)

  • RE: Need help optimizing the performance of a query

    Declare @Results Table (ProductName varchar(50) primary key, TotalPaidAmount decimal(22,2), TransactionCount int, Customers int)

    INSERT INTO @Results

    SELECT ProductName, SUM(paid_amount) AS TotalPaidAmount, count(*) as TransactionCount, distinct(customer_ID) as Customers

    FROM transactions tr1

    WHERE date_of_sale >= '2010-01-01'...

  • RE: Some guidance if you could

    To import your file into a table:

    From SSMS, make sure you have the object explorer open and your database name displayed on the left hand side.

    Right click on...

  • RE: Some guidance if you could

    First things first. You need to get your file of numbers into SQL. If there are a huge number of them, they will need...

  • RE: Parameters

    Ninja is wise.

    With a calendar table you can also do things like add columns for each country you might be working with, so you can define...

  • RE: sql server truncates leading 0's for an integer column

    Yes, i have values in Puma which are not integers(that's why i am casting my ID in Masada table to varchar)....

    Although I feel certain this comes too late, I feel...

  • RE: A type of string search.

    You might also look at full-text searches and full-text indexing.

  • RE: sql server truncates leading 0's for an integer column

    Define a CTE for the PUMA table which eliminates rows containing any characters other than 0-9. Then join to that CTE as shown below. ...

  • RE: sql server truncates leading 0's for an integer column

    sandyinfowave (7/11/2011)


    Here is the query

    select c.ID

    from

    Masada c with (nolock),

    Puma r with (nolock)

    where right('000000' + cast(c.ID as varchar(7)),7) =r.ID

    Masada table has around 2 million records

    Try this:

    select *

    from Masada...

  • RE: loops

    Jason,

    Although we often use hate language when we joke about cursors, blind hatred is not our motivation. The simple fact is they are far too often used...

  • RE: sql server truncates leading 0's for an integer column

    I wouldn't expect padding to add two seconds unless millions of rows were involved.

    Could you possibly publish the actual code you are running, the schema of the tables, and the...

  • RE: loops

    WHILE loops are not necessarily faster than cursors and in fact may be slower than some cursors.

    The problem with both WHILE loops and cursors is that they retrieve...

  • RE: Filter challenge

    I may have to set up a test tonight. I'm curious about how the sorts play out as the volume ramps up.

  • RE: Filter challenge

    Yes, it does.

  • RE: Filter challenge

    Please do check again ... I changed my data slightly and am seeing unexpected results with the new WHERE clause. But you are definitely on the right...

  • RE: Filter challenge

    Paul, I tried your code against the data from my example and no rows were returned. I think the proper WHERE clause should be

    WHERE...

Viewing 15 posts - 1,021 through 1,035 (of 4,081 total)