Viewing 15 posts - 1,021 through 1,035 (of 4,081 total)
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'...
July 12, 2011 at 1:56 pm
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...
July 12, 2011 at 9:41 am
First things first. You need to get your file of numbers into SQL. If there are a huge number of them, they will need...
July 12, 2011 at 7:58 am
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...
July 11, 2011 at 8:26 pm
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...
July 11, 2011 at 3:00 pm
You might also look at full-text searches and full-text indexing.
July 11, 2011 at 2:19 pm
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. ...
July 11, 2011 at 2:05 pm
sandyinfowave (7/11/2011)
Here is the queryselect 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...
July 11, 2011 at 1:24 pm
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...
July 11, 2011 at 12:11 pm
I may have to set up a test tonight. I'm curious about how the sorts play out as the volume ramps up.
July 10, 2011 at 5:49 pm
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...
July 10, 2011 at 12:28 pm
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...
July 10, 2011 at 12:16 pm
Viewing 15 posts - 1,021 through 1,035 (of 4,081 total)