October 26, 2008 at 7:32 pm
And, how does the app know what that latest value is?
--Jeff Moden
Change is inevitable... Change for the better is not.
October 26, 2008 at 8:53 pm
Jeff Moden (10/26/2008)
And, how does the app know what that latest value is?
Whenever any Insert Operation occurs on tbl employee counter_ins will be increment by 1.
October 27, 2008 at 6:00 am
rishgup (10/26/2008)
Jeff Moden (10/26/2008)
And, how does the app know what that latest value is?Whenever any Insert Operation occurs on tbl employee counter_ins will be increment by 1.
Heh... yeah, I know that... I just don't see anything in your code that will return that number back to the app. I also don't see anything that will handle a multi-row insert.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 27, 2008 at 6:59 am
Jeff Moden (10/27/2008)
rishgup (10/26/2008)
Jeff Moden (10/26/2008)
And, how does the app know what that latest value is?Whenever any Insert Operation occurs on tbl employee counter_ins will be increment by 1.
Heh... yeah, I know that... I just don't see anything in your code that will return that number back to the app. I also don't see anything that will handle a multi-row insert.
Jeff,
I only have to count operation performed from Admin panel. And there is only one data entry operator, who logs in and perform operations. maximum operation is updation. i don't want anything on my app. I can run select query to see the data. My only worry is database performance. Will it effect performance???
October 27, 2008 at 8:22 pm
You have to plan on the unexpected... what happens if, someday, there's more than one operator? And what happens if you have to do a "bulk" insert of more than one row for any reason? You've written a trigger that can only handle 1 row and all the others will have a problem if it ever happens.
Also, yes... compared to using an IDENTITY column, the trigger will be a performance problem... but not for just one operator... I'd just plan on there being more than 1 and I'd plan on someone needing to insert more than 1 row someday.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 27, 2008 at 8:29 pm
Jeff Moden (10/27/2008)
You have to plan on the unexpected... what happens if, someday, there's more than one operator? And what happens if you have to do a "bulk" insert of more than one row for any reason? You've written a trigger that can only handle 1 row and all the others will have a problem if it ever happens.Also, yes... compared to using an IDENTITY column, the trigger will be a performance problem... but not for just one operator... I'd just plan on there being more than 1 and I'd plan on someone needing to insert more than 1 row someday.
Can you suggest me something, what I should have to do? Any other way for counting operations?
October 27, 2008 at 9:42 pm
Sure... read the very message of mine that you quoted... lookup IDENTITY in Books Online.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 28, 2008 at 7:32 am
Jeff Moden (10/27/2008)
Sure... read the very message of mine that you quoted... lookup IDENTITY in Books Online.
Jeff,
By identity column you mean IS IDENTITY = 'TRUE' which will increment the identity column on insertion of record?
What if we Delete any record or Update any record? It won't increment the Identity column. I just want numbers.
Rishabh
October 28, 2008 at 9:23 pm
rishgup (10/28/2008)
Jeff Moden (10/27/2008)
Sure... read the very message of mine that you quoted... lookup IDENTITY in Books Online.Jeff,
By identity column you mean IS IDENTITY = 'TRUE' which will increment the identity column on insertion of record?
What if we Delete any record or Update any record? It won't increment the Identity column. I just want numbers.
Rishabh
I'm not sure why you would update a column with the next number on just an Update... heh... never mind a Delete. Could you explain how the "numbers" you want are used just a bit more?
--Jeff Moden
Change is inevitable... Change for the better is not.
October 30, 2008 at 7:10 am
Jeff Moden (10/28/2008)
rishgup (10/28/2008)
Jeff Moden (10/27/2008)
Sure... read the very message of mine that you quoted... lookup IDENTITY in Books Online.Jeff,
By identity column you mean IS IDENTITY = 'TRUE' which will increment the identity column on insertion of record?
What if we Delete any record or Update any record? It won't increment the Identity column. I just want numbers.
Rishabh
I'm not sure why you would update a column with the next number on just an Update... heh... never mind a Delete. Could you explain how the "numbers" you want are used just a bit more?
By number I means count. How many new records are added or deleted or how many records are updated. It my cleint requirement. He wants COUNT after every 15 days..
October 30, 2008 at 7:12 pm
You don't need a counter for that... just store a date on every row and then count the rows in a data range.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply