ar.dll
ar.dll

Reputation: 787

Replace values in column with counter using SQL

I'm looking for an example showing how you would replace all the values in a column by using a counter, so the first row in the column would be xyz1, the second would be xyz2 etc.

I want to replace a whole column with a string I can define concatenated with a number which will increment by one for the next row in the column - the examples I've looked at all seem to refer to another column or primary key as a driver for the counter, I'm not sure why though?

Upvotes: 0

Views: 425

Answers (1)

ivan
ivan

Reputation: 430

CREATE TABLE TMP3(CH VARCHAR2(16 BYTE));

Insert some records... and then

update tmp3 set ch='xyz'||to_char(rownum);

Upvotes: 3

Related Questions