Viewing 15 posts - 361 through 375 (of 581 total)
Writing a function to do that is straightforward - but if it's running a TOP 5 against the table for every input row, the performance could be dire! The tricky...
June 2, 2006 at 9:00 am
Yes, your TOP 5 limits records to the top 5, not the top 5 per customer/item. You could do a correlated TOP 5 subquery but I wouldn't recommend it. There are...
June 2, 2006 at 8:42 am
June 2, 2006 at 8:31 am
you can use SET SHOWPLAN or SET STATISTICS to generate a textual query plan. Have a look at BOL.
sql-server-performance.com might have some stuff on optimisation. For database design theory, you...
June 2, 2006 at 8:03 am
I agree that you should use the new JOIN syntax to make the code easier to read, but it won't necessarily make any difference to the query plan - it certainly...
June 2, 2006 at 7:54 am
<database>.<owner/schema>.<table>,
e.g. select * from newdatabase.dbo.table1
June 1, 2006 at 6:20 pm
Yes that is what happens to temp tables created in dynamic SQL. That's why I suggested creating a stub of a temp table in the calling process, which the dynamic SQL...
June 1, 2006 at 6:09 pm
So if you create a sp which references a table that doesn't exist, then create the table afterwards, the dependency tracker spots it? i.e. it doesn't just use system tables,...
June 1, 2006 at 6:03 pm
You would have to use dynamic SQL to specify which DB to use. And for good reasons, you can't use dynamic SQL in a function.
How many databases do you have...
June 1, 2006 at 5:43 pm
So if you change the sp to just return a row of hardcoded data, it works OK?
June 1, 2006 at 5:33 pm
So to clarify, you want to get all those customers whose latest order is for a larger quantity than the average for that customer's last five paid orders? Should we...
June 1, 2006 at 5:24 pm
I would guess that the difference in your query times is just because of the difference in number of rows processed. Do the other combinations return very few rows?
The left join...
June 1, 2006 at 5:13 pm
Dynamic SQL would give you insurmountable problems in getting dependencies from programmable objects' code. A complete SQL parser would be handy. In the absence of that, a starting point might...
June 1, 2006 at 1:54 pm
Ah yes, nested views:
>Of course I don't know how many tables of what size are in your views, and what optimisation they might bear, or their parents, or their parents' parents...
June 1, 2006 at 1:30 pm
I don't think you can do much except ask for your login to be given access to MSDB. I suppose you could ask for a stored proc or view to be...
June 1, 2006 at 1:24 pm
Viewing 15 posts - 361 through 375 (of 581 total)