| Author |
Topic |
|
khalid.mushtaq
Starting Member
2 Posts |
Posted - 2008-12-03 : 04:35:26
|
| I want to insert a row only at the end of the table. eg:Suppose i have the following data in the table. Name | Addrasdf | #204..qwere | #450..So whenever i execute the "INSERT" command for the Table.The data entered(eg zxccv | #898..) Should be the last row of the table as following: Name | Addrasdf | #204..qwere | #450..zxccv | #898.. Is there any way to insert data that places the info as the last row of the table always(After Executing Every Single Time) . If yes How?(No Concurrency)Thanks |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2008-12-03 : 04:50:46
|
| Not really.What do you mean by the end of the table?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-03 : 04:52:10
|
Usually the chairman sits at the end of the table. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-03 : 05:07:47
|
If ID is an IDENTITY column, the numbering is done automatically. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-03 : 05:12:31
|
You REALLY should make the ID column as an IDENTITY column. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2008-12-03 : 05:19:30
|
| You mean you want the inserted row to have an id 1 greater than the max in the table.insert tblselect (select max(id) + 1 from tbl, 'name', 'address'Could also be done using a trigger.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-12-03 : 05:32:32
|
| Ordering matters only if you want to show data somewhereUse Order by ID when you select dataMadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-12-03 : 05:33:47
|
quote: Originally posted by nr You mean you want the inserted row to have an id 1 greater than the max in the table.insert tblselect (select coalesce(max(id),0) + 1 from tbl, 'name', 'address'Could also be done using a trigger.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy.
In case if there are no data MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-03 : 05:37:59
|
And what about concurrency? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2008-12-03 : 05:40:44
|
| use timestamp to avoid concurrency |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-03 : 05:43:03
|
And using a timestamp is easier than using an IDENTITY? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-03 : 06:30:29
|
OP changes original query after every answer... E 12°55'05.63"N 56°04'39.26" |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-12-03 : 07:31:39
|
I cannot see a query posted by OP  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|