Groups | Blog | Home
all groups > sql server (alternate) > september 2007 >

sql server (alternate) : Updating a row in a recordset


Charlie
9/7/2007 5:04:32 PM
What properties to you set to make a SQL 2005 recordset updatable?

In Access, it's
Recordset.edit
Recordset!FieldName=SomeValue
Recordset.update

Any help is appreciated.

Erland Sommarskog
9/7/2007 9:18:42 PM
Charlie (jadkins4@yahoo.com) writes:
[quoted text, click to view]

There are no properties you can set. Either the column is updatable or
it is not.

Un-updatable columns are for instance computed columns, or columns from
UNION queries.

You can always address the problem by bouncing the data over a temp table.




--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
Dan Guzman
9/8/2007 8:53:38 AM
To add on to Erland's response, APIs that use client cursors often require
that each row have a unique column(s) (e.g. primary key) in order to be
updatable. This is because an UPDATE statement is generated under the
covers and the generated WHERE clause needs to specify values that uniquely
identify the row to be updated. Make sure all tables have a primary key.


--
Hope this helps.

Dan Guzman
SQL Server MVP

[quoted text, click to view]
AddThis Social Bookmark Button