francois_ruel

INSERT into picomp2 using linked server

Discussion created by francois_ruel on Mar 20, 2012
Latest reply on Dec 16, 2014 by Poul

Hi!

 

I want to use an SQL table and load the content to picomp2.

 

My SQL table is an extract from PI, some data adjustment (on timestamp), clear the data for those tags and reload the corrected data.

 

Table was created by a Select into query

 

I used something like:

 

INSERT INTO OPENQUERY([PI1-GPS],'SELECT tag,time,value from [piarchive]..[picomp2] where 1=0') (tag,time,value) SELECT tag,time,value from tagUpd where value is not null

 

or this:

 

INSERT INTO [PI1-GPS].[piarchive]..[picomp2] (tag,time,value) SELECT tag,time,value from tagUpd where value is not null

 

And get this:

 

Msg 8114, Level 16, State 11, Line 1

 

Error converting data type nvarchar to (null).

 
Any suggestion?
Is there anything about casting?
Francois

Outcomes