Author |
Topic |
messi
Starting Member
47 Posts |
Posted - 2008-09-07 : 15:35:44
|
i created two tables in my databasei need when i add a number ex(10) to the first in a fielda trigger add 10 records to the second tableanyone know please help |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-07 : 15:54:55
|
http://msdn.microsoft.com/en-us/library/ms189799.aspx |
|
|
messi
Starting Member
47 Posts |
Posted - 2008-09-07 : 16:50:21
|
thanks for replaying but can you give me the sql statementbecause i couldn't figure out the statement by myself (i am a beginner) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-08 : 03:00:27
|
quote: Originally posted by messi i created two tables in my databasei need when i add a number ex(10) to the first in a fielda trigger add 10 records to the second tableanyone know please help
Can you tell us what would be the 10 records for second table?MadhivananFailing to plan is Planning to fail |
|
|
messi
Starting Member
47 Posts |
Posted - 2008-09-08 : 10:22:40
|
i need when i add 10 to num field in table1 : trigger add 10 records in table 2: |
|
|
messi
Starting Member
47 Posts |
Posted - 2008-09-08 : 17:12:16
|
i really need this trigger please help...... this is my first question don't disappoint me |
|
|
lamujerdetuhermano10
Yak Posting Veteran
75 Posts |
Posted - 2008-09-08 : 18:09:00
|
create TRIGGER addNumbersON computerscaAFTER INSERTasexec adds------------------------create proc adds asdeclare @count intset @count = 1while @count < 11begininsert computersNV (computerid)select @countselect @count = @count +1end |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-09-08 : 18:40:25
|
and what happens when someone inserts 2000000000 into that column? elsasoft.org |
|
|
messi
Starting Member
47 Posts |
Posted - 2008-09-08 : 18:49:43
|
Thank you very much it worked with me |
|
|
messi
Starting Member
47 Posts |
Posted - 2008-09-08 : 18:52:50
|
quote: Originally posted by jezemine and what happens when someone inserts 2000000000 into that column? elsasoft.org
i just need the idea |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-09-08 : 19:01:50
|
you could improve on that trigger suggestion a lot by using a numbers table - then you wouldn't have a while loop. that while loop will kill your perf. elsasoft.org |
|
|
messi
Starting Member
47 Posts |
Posted - 2008-09-08 : 19:25:04
|
quote: Originally posted by jezemine you could improve on that trigger suggestion a lot by using a numbers table - then you wouldn't have a while loop. that while loop will kill your perf. elsasoft.org
thanks for your replaybut what i can do in this trigger ( is there another way to make it) |
|
|
|