Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Triggers

Author  Topic 

almanac
Starting Member

5 Posts

Posted - 2007-10-02 : 16:51:26
Hi,
I was wondering if sombody could help with a trigger problem. I need to write a trigger to count the number of times sombody uses a sumbit button so i can limit them to a certain number. Any ideas would be gratefully received.

Cheers

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-02 : 16:58:13
this has nothing to do with triggers.
you should handle this in your front end.
put a javascript that disables the button after submit or something similar.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

almanac
Starting Member

5 Posts

Posted - 2007-10-02 : 17:02:33
Hi,

thanks for that unfortunatley i have been requested to make it happen in sql server and i'm having a bit of a brain freeze on how to do it.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-02 : 17:15:41
well it depends on what your submit button does to the table.
if it inserts then simply check the table for existance of the row.
if it updates then update it again with old values.

or you can try to use instead of trigger.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

almanac
Starting Member

5 Posts

Posted - 2007-10-02 : 17:23:11
I've been thinking about using an after update trigger on the table. The submit button is entering a new record into one of the tables columns each time it's activated. I guess basically i want to count the number of times that person adds a new record to a specific column.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-10-02 : 22:59:46
Does the submit button calls SP to perform the INSERT ? why not code the count you want in the INSERT SP


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -