Hi,
I am having an issue trying to pass single quotes:
SET @ImpDirectory = 'C:\Users\doug\Documents\Projects\Wrapaway\Wrap History Files\1206\'
SET @ImpAgentFile = 'agent.txt'
SET @FldTerminator = '{'
SET @RowTerminator = '0x0a'
CREATE TABLE tblTemp (agentno INT,runno INT,runpos INT,name VARCHAR(30),street VARCHAR(30),townVARCHAR(30),postcode INT,
phone VARCHAR(12),currentdebt SMALLMONEY,day30 SMALLMONEY,day60 SMALLMONEY,
day90 SMALLMONEY,lastpay VARCHAR(8),
contact VARCHAR(20),remarks VARCHAR(30),autoord VARCHAR(1),xrunno INT, vrunno INT,yrunno INT,privatecomment VARCHAR(60))
Set @ImportFile = '''' + @ImpDirectory + @ImpAgentFile + ''''
SET @FldTerminator = '''' + @FldTerminator + ''''
SET @RowTerminator = '''' + @RowTerminator + ''''
Set @SQL = 'BULK
INSERT tblTemp
FROM ' + @ImportFile +
'WITH (
FIELDTERMINATOR = ' + @FldTerminator +
''', ROWTERMINATOR = ' + @RowTerminator + ' )'
EXEC (@SQL)
print @SQL
print @ImportFile
print @FldTerminator
print @RowTerminator
I dont understand why
print @FldTerminator gives me '{ and not '{'
print @RowTerminator gives me '0 and not '0x0a'
Thanks for any advice
Regards Doug