Viewing 15 posts - 4,606 through 4,620 (of 5,504 total)
I expect string concatenation as well, based on OPs statement
My strings, though, can be up to 50-100 characters long, and the database just doesn't seem to be able to...
January 5, 2010 at 3:05 am
The major issue I can see so far is using varchar(max).
If possible for your solution, change it to varchar(8000) or less.
It seems like the dowside of varchar(max) (being too long...
January 4, 2010 at 4:56 pm
Please post table def and sample data as described in the first link in my signature.
January 4, 2010 at 3:45 pm
lmu92 (1/4/2010)
select * from wce_history where recordedtime >= dateadd(mm,-2,getdate())
dateadd is used to calculate date offsets based on a given date. Getdate() is current date, current time. Please see BOL (Books...
January 4, 2010 at 3:27 pm
Well, since we just have learned that you're looking for a dynamic solution, here it is:
Step 1: running the code from before excluding the PIVOT part, but storing the result...
January 4, 2010 at 3:12 pm
You're very welcome!
Would you mind sharing the results for both versions when applied to your "real data" for both solutions? (including total number of rows in table and indexes on...
January 4, 2010 at 1:58 pm
Justin James (1/4/2010)
... There has to be a way around using ISNULL. ...
YES, there is: Try a different solution!
I have to ask again: What is your reason for refusing to...
January 4, 2010 at 1:50 pm
Basically, to explain the concept of an index the easiest way I've seen so far is to compare an indexed table with a phone book, where the table index equals...
January 4, 2010 at 11:10 am
Here's another version using a CTE to check that both billing types exist.
Assuming the required indexes are available, it is slightly faster than your solution (about 20% as per execution...
January 4, 2010 at 10:53 am
You're very welcome and thank you for the feedback! 🙂
I still recommend reading the article I referred to. It's helpful to know how it works. Just in case... 😉
January 4, 2010 at 9:35 am
Something like this?
SELECT ol.orderid,ol.billingType,ol.BillingFlag,count(ol.billingType) as 'Num order Lines'
FROM orderlines ol
WHERE OrderLineStatus<>'HIS'
AND (
(ol.billingtype = 'INI'
and ol.BillingFlag = 'F'
)
OR
(
ol.billingType = 'SCH'
and ol.BillingFlag = 'T'
)
)
GROUP BY ol.orderid,ol.billingType,ol.BillingFlag
January 4, 2010 at 9:02 am
There are a couple issues with the way your query is written:
1) the query will not benefit from any index since you applied a function to the column you query...
January 4, 2010 at 8:45 am
If you can add a column to your table to store the running total in AND create a CLUSTERED index on startup_Time, then you could use the "quirky update" method...
January 4, 2010 at 7:54 am
If you want/need to do it without SSRS you might want to read the two articles I referenced below regarding CrossTab and DynamicCrossTab.
January 4, 2010 at 7:16 am
Viewing 15 posts - 4,606 through 4,620 (of 5,504 total)