Viewing 15 posts - 361 through 375 (of 5,393 total)
If you have to eliminate fruit that are not completely covered by the stock, this should work:
SET STATISTICS TIME ON;
SET STATISTICS IO ON;
DECLARE @tmp TABLE(fruit VARCHAR(50),shop VARCHAR(10),preference INT, qty INT)
INSERT...
-- Gianluca Sartori
June 24, 2015 at 2:37 am
I don't understand what should happen if there is not enough stock to cover the order. Should the fruit be ignored?
Can you post the expected output based on that sample...
-- Gianluca Sartori
June 24, 2015 at 2:23 am
You need the VIEW SERVER STATE permissions to run this query:
SELECT cpu_count AS [Logical CPU Count], hyperthread_ratio AS [Hyperthread Ratio],
cpu_count/hyperthread_ratio AS [Physical CPU Count],
--physical_memory_in_bytes/1048576 AS [Physical Memory (MB)] ...
-- Gianluca Sartori
June 23, 2015 at 1:34 am
ChrisM@Work (6/22/2015)
Alvin Ramard (6/22/2015)
GilaMonster (6/22/2015)
-- Gianluca Sartori
June 22, 2015 at 9:01 am
I formatted the code and added some commenst.
It should be clearer now.
-- this defines a CTE: think of it as an "inline view"
-- that you can reference anywhere in...
-- Gianluca Sartori
June 22, 2015 at 8:42 am
It deletes from the #temp table. If you don't understand this code, don't use it.
-- Gianluca Sartori
June 22, 2015 at 8:19 am
The clients will never use the node IP address to connect to SQL Server. Just open the port on the virtual IP address.
-- Gianluca Sartori
June 22, 2015 at 1:57 am
bugg (6/19/2015)
spaghettidba (6/19/2015)
Ah, great. Glad I could help.Might sound like a weird question, but: is this really a database for selling fruit? 🙂
🙂 not fruit but selling other products,...
-- Gianluca Sartori
June 19, 2015 at 6:23 am
Ah, great. Glad I could help.
Might sound like a weird question, but: is this really a database for selling fruit? 🙂
-- Gianluca Sartori
June 19, 2015 at 6:03 am
I assume you didn't see my latest attempt. It should solve your speed issues.
-- Gianluca Sartori
June 19, 2015 at 4:48 am
I just noticed that I'm an idiot: the RN column is already the running sum in this case, so you don't need to calculate it with another triangular join:
DECLARE @tmp...
-- Gianluca Sartori
June 19, 2015 at 4:36 am
Sorry, I repeated my tests and yes, it's dog slow 🙂
-- Gianluca Sartori
June 19, 2015 at 4:32 am
If you have thousands of fruits, probably sys.all_columns does not have enough rows for your tally table. You may need to CROSS JOIN with sys.all_columns again and select just the...
-- Gianluca Sartori
June 19, 2015 at 4:30 am
Probably the query that reads the data is using a different execution plan than usual. Try detecting it using sp_whoisactive.
-- Gianluca Sartori
June 19, 2015 at 2:57 am
Viewing 15 posts - 361 through 375 (of 5,393 total)