Viewing 15 posts - 376 through 390 (of 5,394 total)
I think that you should explode your stock quantity using a tally table.
This should do:
DECLARE @tmp TABLE(fruit VARCHAR(50),shop VARCHAR(10),preference INT, qty INT)
INSERT INTO @tmp(fruit,shop,preference,qty) VALUES ('orange','shop 1',1 ,1)
INSERT INTO @tmp(fruit,shop,preference,qty)...
June 19, 2015 at 2:51 am
This is a situation where a pure set-based solution will not offer a complete solution in a single pass.
It is a variation of the famous "packing bins" problem. Joe Celko...
June 19, 2015 at 1:55 am
I agree with Steve: we need to know the logic for ranking rows. SQL2012 would make it considerably easier and more efficient.
This should work, assuming you have to group by...
June 18, 2015 at 8:42 am
It is unclear to me what is the expected output. Can you please include it in your post?
Here is a description of how to post it: http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/
June 18, 2015 at 3:55 am
Don't do that. Script the server-scoped objects you want to move instead.
This tool will help you: https://github.com/billgraziano/ScriptSqlConfig. It doesn't script all possible object types, but it's a start.
June 18, 2015 at 3:52 am
Good point, Matt.
A combination of SIGN and ABS will probably help in that case, depending on the logic.
June 17, 2015 at 9:59 am
RTM is the product level, Standard is the edition. They're two different things.
Product level means which updates (service packs and CUs) are installed.
Edition means which features are included in...
June 17, 2015 at 4:37 am
This should do:
DECLARE @values TABLE (
someValue float,
expectedOutput float
)
INSERT INTO @values
VALUES
(50.99, 50.00),
(53.58, 50.00),
(55.23, 55.00),
(55.00, 55.00),
(57.58, 55.00)
SELECT *, calcValue = FLOOR(someValue / 5) * 5
FROM @values
Output:
+-----------+----------------+-----------+
| someValue | expectedOutput |...
June 17, 2015 at 4:30 am
nichi (6/17/2015)
Resolved with this commandgrant execute on sp_send_dbmail to public
I hope it is the correct way
Thanks
Nope: this way every user in the msdb database has permissions to run sp_send_dbmail.
GRANT EXECUTE...
June 17, 2015 at 4:04 am
You could also create a temporary stored procedure (just prepend # to the proc name).
June 17, 2015 at 3:54 am
If it's causing perf issues it's because it's running.
Look at the activity monitor or sys.dm_exec_* DMVs to identify the SPID and kill it.
June 17, 2015 at 3:49 am
I don't see the problem: create it, grab the execution plan, then drop it.
If it overwrites an existing procedure, create it with a different name.
June 17, 2015 at 3:44 am
Viewing 15 posts - 376 through 390 (of 5,394 total)