Skip to content
Advertisement

“Error when converting the nvarchar value “–” to the int-data type.”

I haven’t been working with SQL for that long because I’m still relatively new to the world of IT specialists. Currently I’m working on a report for an automated documentation and get the following error

Error when converting the nvarchar value “–” to the int-data type.

select tAccounts.*
from tAccounts, tDomains, tADSDocu
where tAccounts.AccountID = tDomains.AccountID
and tDomains.DomainID = tADSDocu.DomainID and tAccounts.AccountName = {PrimaryKey}

I’ve only recently started with SQL.

Advertisement

Answer

Probably the AccountName field is nvarchar and your PrimaryKey is int, that’s why this may occur, maybe something like this might work;

select tAccounts.*
from tAccounts, tDomains, tADSDocu
where tAccounts.AccountID = tDomains.AccountID
and tDomains.DomainID = tADSDocu.DomainID and tAccounts.AccountName = '{PrimaryKey}'
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement