A表
F_clientID F_ItemID F_UnitID F_Grade F_Color F_BatchNo
281 16 2 700 芷青 0 281/16/2/700/芷青/0
281 16 2 600 中灰 0 281/16/2/600/中灰/0
281 16 30 1000 军绿 0 281/16/30/1000/军绿/0
select F_ClientID,F_UnitID,F_ItemID,F_Grade,F_color,F_BatchNo,
cast(F_ClientID as Varchar(30))+'/'+cast(F_UnitID as Varchar(30))+'/'+cast(F_ItemID as Varchar(30))+'/'+F_Grade+'/'+F_Color+'/'+F_BatchNo as F_BarCode from A
是得到这列值,但我想通过字段的计算获得这一列,字段中如何设置
------解决思路----------------------
--这样? 用计算列
create table A
(
F_ClientID int,
F_UnitID int,
F_ItemID int,
F_Grade varchar(10),
F_Color varchar(10),
F_BatchNo varchar(10),
F_BarCode as cast(F_ClientID as Varchar(30))+'/'+cast(F_UnitID as Varchar(30))+'/'+cast(F_ItemID as Varchar(30))+'/'+F_Grade+'/'+F_Color+'/'+F_BatchNo
)