gpt4 book ai didi

vb.net - 计算列规范

转载 作者:行者123 更新时间:2023-12-01 02:01:03 24 4
gpt4 key购买 nike

CREATE TABLE PaperTable
(
PaperID int IDENTITY (1,1) NOT NULL
, PageNumber varchar(100)
, PaperAlphaID AS Cast(Right(Year(getDate()),2) as varchar(2)) +'-'+ PageNumber
);

当我添加“001”和“002”作为我的论文编号时得到的结果:
PaperID   PageNumber  PaperAlphaID
------- ---------- ------------
1 001 15-001
2 002 15-002

但我想在 PaperAlphaID 中显示全年
PaperID   PageNumber  PaperAlphaID
------- ---------- ------------
1 001 2015-001
2 002 2015-002

代替 15-001 和 15-002

最佳答案

删除 RIGHT 函数并更新 varchar(4)

CREATE TABLE PaperTable
(
PaperID int IDENTITY (1,1) NOT NULL
, PageNumber varchar(100)
, PaperAlphaID AS Cast(Year(getDate())) as varchar(4)) +'-'+ PageNumber
);

关于vb.net - 计算列规范,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36335509/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com