SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Operand type clash: int is incompatible with text
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

akamole
Starting Member

16 Posts

Posted - 02/24/2014 :  05:09:16  Show Profile  Reply with Quote
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

United Kingdom
3603 Posts

Posted - 02/24/2014 :  05:30:15  Show Profile  Reply with Quote
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

16 Posts

Posted - 02/24/2014 :  06:45:07  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000