I have created a linked server (PostgreSQL). When I try to import data from SQL Server to linked server I get the following error:
String or binary data would be truncated
Even though I am familiar with this error, I have never faced it for the text data type. There is only text datatype in my table.
I would like to know is there are any limitation in linked server?
I have created a test table with a text column. When I try to insert from my linked server I can't insert more than 4000 characters. For testing purpose only I did this but actually I need to import data from SQL to p-sql.
Created following table in p-sql using pg admin
create table test_sql ( col text )
When I try to then inserted values
insert into linkedserver.database.schema.table (col)
values ('4001 char')
but it fails to insert.
I have successfully created linked server with below query:
EXEC master.dbo.sp_addlinkedserver
@server = N'Test_server',
@srvproduct=N'PostgreSQL Unicode(x64)',
@provider=N'MSDASQL',
@provstr=N'Driver=PostgreSQL Unicode(x64);uid=postgres;Server=######;database=test_db;pwd=password;SSLmode=disable;PORT=5432'
text
, maybe it gets incorrectly mapped in SQL Server to something else (and something too short).