我创建了一个表
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DimRegion2013]') AND type in (N'U'))
DROP TABLE [DimRegion2013]
Go
Create Table DimRegion2013
(RegionKey int NOT NULL identity Primary Key,
RegionView char(1),
RegionViewCode char(1),
SublocationString nvarchar(7),
SubLocationCode char(10),
LocationCode char(10),
RegionCode char(10),
RegionGrpCode char(10),
DivisionCode char(10),
DivisionGrpCode char(10),
SubLocationDescription char(50),
LocationDescription char(50),
RegionDescription char(50),
RegionGrpDescription char(50),
DivisionDescription char(50),
DivisionGrpDescription char(50))
然后我尝试将数据插入到 DimRegion2013 表中。
Select
'Region1' as RegionView,
'R1' as RegionViewCode,
sl.sublocationstring,
sl.subLocationCode,
l.locationcode,
r.regioncode,
rg.RegionGrpCode,
d.DivisionCode,
dg.DivisionGrpCode,
sl.SubLocationDescription,
l.LocationDescription,
r.regiondescription,
rg.RegionGrpDescription,
d.divisionDescription,
dg.DivisionGrpDescription
from SMECSubLocation sl,
SCLocation l,
SCRegion r,
SCRegionGrp rg,
SCDivision d,
SCDivisionGrp dg
where l.LocationCode = sl.LocationCode
and r.RegionCode = l.RegionCode
and r.RegionGrpCode = rg.RegionGrpCode
and d.divisioncode = rg.divisioncode
and d.divisiongrpcode = dg.divisiongrpcode
我得到这个错误
消息 8152、级别 16、状态 14、第 4 行
字符串或二进制数据将被截断。
我看不出有什么问题。请帮我解决这个问题。
谢谢!
博