After an insert into a temp table using the OUTPUT clause, I am getting an extra character(s) that are not in the source.
Why?
--
E.g. after insertion from existing PhysicalTable_1 table record with LName = 'John' the destination PhysicalTable_1 table as well as the #Temp table have '?John' or 'I?John' it occurs sometime for Lname, sometime for FName or Email as well as other fields.
An example of data in the PhysicalTable_1 - FName = 'Raul' And destination record after insertion looks like = '?Raul'
I'm using this:
CREATE TABLE #Temp
(
ID INT NOT NULL,
LName VARCHAR(75) NULL,
FName VARCHAR(75) NULL,
Email VARCHAR(125) NULL
)
CREATE TABLE PhysicalTable_2
(
ID INT NOT NULL,
LName VARCHAR(75) NULL,
FName VARCHAR(75) NULL,
Email VARCHAR(125) NUL
)
CREATE TABLE PhysicalTable_1
(
ID INT NOT NULL,
LName NVARCHAR(500) NULL,
FName NVARCHAR(500) NULL,
Email NVARCHAR(500) NULL
)
INSERT INTO PhysicalTable_2
(
LName, FName, Email
)
OUTPUT INSERTED.LName, INSERTED.FName, INSERTED.Email
INTO #Temp
SELECT LName, FName, Email
FROM PhysicalTable_1
I also tried to change all string fields data types of #Temp table to NVARCHAR. Still some records in the destination ended up having extra characters