Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Operand type clash: int is incompatible with text

Author  Topic 

akamole
Starting Member

17 Posts

Posted - 2014-02-24 : 05:09:16
Im trying to combine columns and add it to an existing table

insert into Future_Link.dbo.tbFLink (Fastighet, Anlaggning)
values (
(select strFastbeteckningTrakt + ' ' + strFastbeteckningBlock + strFastbeteckningTecken + intFastbeteckningEnhet
from EDPFutureGagnef.dbo.tbFuAnlaggning),
(select strAnlnr
from EDPFutureGagnef.dbo.tbFuAnlaggning)
)

Generate error:
Msg 206, Level 16, State 2, Line 1
Operand type clash: int is incompatible with text

I understand why it wont work but not how to fix it

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2014-02-24 : 05:30:15
Do you have a data type of text in one of strFastbeteckningTrakt, strFastbeteckningBlock or strFastbeteckningTecken ?

If not and they are char or varchar, you can do:

insert into Future_Link.dbo.tbFLink (Fastighet, Anlaggning)
values (
(select strFastbeteckningTrakt + ' ' + strFastbeteckningBlock + strFastbeteckningTecken + CONVERT(VARCHAR(10),intFastbeteckningEnhet)
from EDPFutureGagnef.dbo.tbFuAnlaggning),
(select strAnlnr
from EDPFutureGagnef.dbo.tbFuAnlaggning)
)


Else you will have to use UPDATETEXT.. Look here: http://technet.microsoft.com/en-us/library/ms189466.aspx
Go to Top of Page

akamole
Starting Member

17 Posts

Posted - 2014-02-24 : 06:45:07
Thank you! I ended up with this:
insert into future_link.dbo.tbFLink (Fastighet, Anlaggning)
select strFastbeteckningTrakt + ' ' + strFastbeteckningBlock + strFastbeteckningTecken + convert(VARCHAR(10), intFastbeteckningEnhet), strAnlnr
from EDPFutureGagnef.dbo.tbFuAnlaggning

Go to Top of Page
   

- Advertisement -