开发者

SQl issue adding a char before id field , how?

开发者 https://www.devze.com 2023-02-28 16:23 出处:网络
CREATE TABLE customer (id varchar, sal int); insert into customer values (1,500); insert into customer values (2,500);
CREATE TABLE customer
(id varchar,
sal int);

insert into customer values (1,500);
insert into customer values (2,500);
insert into customer values (3,500);
insert into customer values (4,500);
select开发者_Python百科 * from customer;

update customer set id = 'sss'+id;

select * from customer;

My ideone link

I missed the 'sss' word before the id while creating, I thought update would do it, but how?


update customer set id = 's' || cast(id as varchar(10)); 

Works in your IdeOne environment.

0

精彩评论

暂无评论...
验证码 换一张
取 消