我的生产中的表格具有列类型create procedure p_sync_from_remote
as
begin
declare @lastitem Datetime =
(select top 1 Time_Stamp from table_destination order by Time_Stamp desc)
if (@lastitem is null) or (len(@lastitem) <= 0)
begin
insert into table_destination
select * from table_source
end
else
begin
insert into table_destination
select * from table_source where Time_Stamp > @lastitem
end
end
exec p_sync_from_remote
所有行在该列中的条目不得超过15个字符,并且永远不会更大。我决定使用我在sof上找到的以下命令将其大小减小到15个字符:
character varying(255);
我收到了以下错误:
ALTER TABLE user_template ALTER COLUMN "TYPE" character varying(15);
你可以帮我解决一下吗?感谢。
答案 0 :(得分:1)
create table user_template (field1 varchar(255));
✓
ALTER TABLE user_template ALTER COLUMN field1 TYPE varchar(15);
✓
dbfiddle here