MS SQL Server: duplicating a record without specifying each field and value (Reported, not reproduced)

Applies to: reported in 2004 against MS SQL Server; the Clarion version is not named in the thread.

Problem as reported

The poster wanted to duplicate a record in a table without listing each field and a value. A hand-written list of fields has to be edited whenever the table changes during product development. He asked for a way that does not depend on the field list.

What the thread found

  • One poster gave Clarion code: set the primary key field, fetch the record with Access:MyFile.Fetch, change whatever must be unique (or CLEAR the primary key field when it is autonumbered in Clarion), then call Access:MyFile.Insert() and test for LEVEL:Benign. The code depends only on the primary key and its fields.
  • The original poster replied that he was looking for an SQL script, not Clarion code.
  • A third poster doubted that a script would be found unless the table has a unique key, and added that a table without one should have one.
  • The thread ends there. No SQL statement was offered, so nothing in it settles the script question.

Caveats

  • The fetch-and-insert code was not reported as tried by the original poster; he declined it as not what he asked for.
  • The thread does not say how an autonumbered key on the server side behaves in the insert.
  • The code does not use a field list, so it follows table changes without edits.

Today (2026)

Not reproduced. This entry records a 2004 report. If you have a server-side statement that copies a row without naming the columns on a current build, say so in the comments and the entry closes.

Sources: Delme G. (Oct 2004, the question), Arnor B., Bernard G. (Oct 2004) in softvelocity.clarion.databasedrivers.