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.
| Author |
Topic |
|
oneforall2012
Starting Member
4 Posts |
Posted - 2008-02-07 : 03:07:14
|
| Hello therei have a Table with tow fields(book,row),both fields are integers book field is Identity Increment now i want to increase row value by 1 when book values became 25here is an exampleBook -- Row1 12 13 14 1..25 126 2now you see that when Book became 26 , Row raised by 1 and became 2any ideasthnx |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-07 : 03:46:50
|
UPDATE TableSET Row = 1 + Book / 26 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
oneforall2012
Starting Member
4 Posts |
Posted - 2008-02-07 : 04:40:44
|
| thnx Peso but i need this when i am going to insert the new record thnx |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-07 : 04:47:48
|
INSERT TableVALUES (-1)UPDATE TableSET Row = Book / 26WHERE Row = 0 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-07 : 04:51:31
|
Or create a INSERT trigger? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
oneforall2012
Starting Member
4 Posts |
Posted - 2008-02-07 : 05:48:00
|
| i found the soluation of this matter i have to make the row field computed and type the folowing in the Formula convert(int,Book/25) thnx Peso for your helpSalam |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-07 : 06:16:29
|
How are you going to insert a value to this table?DECLARE @Test1 TABLE (Book INT IDENTITY(1, 1) PRIMARY KEY, Row AS (1 + Book / 25))SELECT *FROM @Test1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|