Forum Replies Created

Viewing 15 posts - 61 through 75 (of 221 total)

  • RE: Combined Ranking

    The more i try work this out the more I want to do a loop :laugh: so i can keep a balance of what fruit was taken from what shop.

  • RE: Combined Ranking

    Spreads over to the next shop.

    This is sort of what happening with the last code I posted . It correctly brings back the required shops in stock order and preference

    However...

  • RE: Combined Ranking

    Thanks for everyone's help, spaghettiDBA almost cracked it. I changed the where statement "WHERE qty > 0 AND (runningSum.run_sum - qty) < @findqty"

    Here is the full example below. Last thing...

  • RE: Combined Ranking

    spaghettidba (6/18/2015)


    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...

  • RE: Combined Ranking

    Getting closer with this query using CTE

    DECLARE @tmp TABLE(fruit VARCHAR(50),shop VARCHAR(10),preference INT, qty INT)

    INSERT INTO @tmp(fruit,shop,preference,qty) VALUES ('apple','shop 1',1 ,0)

    INSERT INTO @tmp(fruit,shop,preference,qty) VALUES ('apple','shop 2',2 ,3)

    INSERT INTO @tmp(fruit,shop,preference,qty) VALUES ('orange','shop...

  • RE: Combined Ranking

    spaghettidba (6/18/2015)


    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/

    Updated the top,...

  • RE: Combined Ranking

    DELETED

  • RE: Split Row into Multiple Rows

    Mark Cowne (5/3/2012)


    Join to a numbers/tally table

    SELECT s.ORDER_NUMBER, s.PRODUCT_ID, 1 AS QTY, s.VALUE/s.QTY AS VALUE

    FROM @SPLITROW s

    INNER JOIN master.dbo.spt_values t ON t.type='P'

    AND t.number...

  • RE: Idera SQL Check: idling in transaction (dangerous)

    SQL Check is showing this for me too but no transactions are in an open state is this a VMWARE issue?

    This is on SQL Server 2012 Standard

    Thanks

    B

  • RE: SQL Server Agent Disbled

    Shafat Husain (12/15/2014)


    Dear Bugg,

    Check the windows event viewer. Under application check SQL Server.

    You will definitely find something useful

    Hope it helps..!!

    Regards

    Shafat Husain

    Thanks Shafat unfortunately the event viewer isn't setup to store...

  • RE: SSMA for Access, how to convert a field's switch statement to sql?

    php_guy (10/28/2014)


    I have an Access DB. in that DB there is a table which has a field which contains a switch statement. I want to carry this function over to...

  • RE: SQL Injection Attack

    Eirikur Eiriksson (10/28/2014)


    Looks like this is coming from sqlmap (sqlmap.org), automated injection tool.

    😎

    Yep... this is what i mentioned in my original post.;-)

  • RE: SQL Injection Attack

    GilaMonster (10/28/2014)


    Rather focus on making your app injection-proof.

    They wouldn't have used public for this, they'd have been using whatever the application's account is, since it's a query exploiting the application's...

  • RE: SQL Injection Attack

    I thought as much. Is there a way to deny the public role read access to system tables?

  • RE: DEADLOCKS on SELECT statements with UPDLOCK hint

    I created a covering index and included all columns being returned in the select statement, this has stopped the Deadlocks. It doesn't feel right just including all columns in the...

Viewing 15 posts - 61 through 75 (of 221 total)