I am inserting about a hundred rows of about 80 columns from a csv into a sql table. they all have an identity PK and a batchid that identifies them as a set
I another procedure I am selecting all the rows where batchid = @batchid into #temp
I am making a lot of changes to these rows but never deleting or adding any and it seems more convenient to work with this subset rather than have to qualify everything with batchid if I work directly against the table.
But when I get done i want to basically replace the rows in the table with data in the temp table.
I know I can do that as shown below, but is there a better way that does not require writing 80 column matches? I tried a.* = b.* but it doesn't seem to like that.
UPDATE a
set
a.fld1 = b.fld1,
a.fld2 = b.fld2,
...etc
FROM maintable a
inner join #temp b
where a.pk = b.pk
TIA
Charles Hankey
Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy
Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.
-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin
Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.