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 |
|
ugpjava
Starting Member
4 Posts |
Posted - 2005-09-07 : 22:19:52
|
| How to override a row...i.e: if i insert a value to the database it will allocate a new row for it. Think..if i put reg# as 101 -> allocate a seperate row & input values if i put another row regrading reg# 101 it will allocate a new row... *I want to avoid this...Can we override the existing row with our new data.Other thing is...*************************How to append to a row...i.e: if i insert a value to the database it will allocate a new row for it. Think..if i put reg# as 101 -> allocate a seperate row & input values if i put another row regrading reg# 101 it will allocate a new row... *I want to avoid this...Can we append the existing data with our new data, in the same row.pls..anybody tell me.thanks. |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-09-07 : 22:30:28
|
quote: if i insert a value to the database it will allocate a new row for it.
Well, yes, that's what an INSERT operation is supposed to do. I think what you want to do is an UPDATE operation. |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-09-07 : 23:36:00
|
i think you're doing this in Enterprise Manageryou need to do this in Query Analyzerto determine if the row exists for the said ID,you can use: if exists(select * from tablename where colID='uniqueID') print 'this row exists so do the update here'else print 'this row does not yet exist so do the insert here' but i suggest you divide the inserts from updates if this is a bulk operation--------------------keeping it simple... |
 |
|
|
|
|
|