generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: SQL Trigger help pls

Previous Thread :: Next Thread 
cymru72 is not online. cymru72
Joined: 26 Jan 2008
Total Posts: 4362
25 Apr 2012 02:28 PM
CREATE TRIGGER handleThreads AFTER UPDATE, INSERT ON Threads
SELECT * FROM Threads
ORDER BY update_time DESC
DECLARE @ThreadCount int
SET @ThreadCount = (SELECT COUNT(*) FROM Threads);
IF @ThreadCount > 5
FOR EACH ROW BEGIN
DELETE FROM Threads WHERE order_ID > 5
END
END;

Not sure what's wrong :(? Trying to create a trigger on the 'Threads' table. Want it to update the order of the rows, count them and check if they exceed 5 and if so delete those that exceed that order number. Help pls :(
Report Abuse
NinjaShadow1 is not online. NinjaShadow1
Joined: 03 Mar 2009
Total Posts: 2689
25 Apr 2012 04:05 PM
Is it giving you an error?
Report Abuse
NinjaShadow1 is not online. NinjaShadow1
Joined: 03 Mar 2009
Total Posts: 2689
25 Apr 2012 04:05 PM
Also, have you gone to stackoverflow yet?
Report Abuse
cymru72 is not online. cymru72
Joined: 26 Jan 2008
Total Posts: 4362
25 Apr 2012 04:09 PM
Oh, whoops. I meant to post that.. Yeah, here it is:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' INSERT ON Threads
SELECT * FROM Threads
ORDER BY update_time DESC
' at line 1
Report Abuse
cymru72 is not online. cymru72
Joined: 26 Jan 2008
Total Posts: 4362
25 Apr 2012 04:11 PM
Ignore that, fixed it. Dw, thanks though
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image