我對SQL編碼有點新,我試圖選擇一個nvarchar
值並將其插入到tinyint
列中。將nvarchar轉換爲tinyint
我用下面的查詢
insert into COV (GID, DocumentNumber, RegistrationDate, CustomerCode, CustomerName, DeliveryDateAndTime, LineGID, Item, Quantity, DeliveryDate, MU, ExportedToSchnell)
select
esd.GID, esd.ADCode, esd.ADRegistrationDate, esc.Code, esc.Name,
esd.DeliveryDueDate, esfl.GID, esf.Code, esfl.Quantity,
esfl.DeliveryDate, esmm.fMUCode, esfl.Stringfield1
from
ESFIDocumentTrade esd
left join
ESFITradeAccount esc on esd.fTradeAccountGID = esc.GID
left join
ESFIDocumentType est on esd.fADDocumentTypeGID = est.GID
left join
ESFILineItem esfl on esfl.fDocumentGID = esd.GID
left join
ESFIItem esf on esf.GID = esfl.fItemGID
left join
ESMMItemMU esmm on esmm.fItemGID = esf.GID
where
est.Code = 'COV'
and esfl.StringField1 = 'YES'
and esd.ADRegistrationDate > '2017-02-01'
,但我得到了以下錯誤:
Conversion failed when converting the nvarchar value 'YES' to data type tinyint.
我試圖施放nvarchar
列,但我無法弄清楚如何做到這一點。
你能幫我嗎?由於
SzlZim?那是誰 ? :P – SqlZim
@SqlZim我的地形。我修好了它。 – DVT
好點,+1 – SqlZim