所以我的问题是我不完全确定我应该使用哪个行终结器。我使用过使用过|,\ r \ n,0x0a。但似乎没有任何效果。我正在导入一个我没有创建的数据集但是已经设置了
column1row1 | column2row1 | column3row1 | column1row2 | column2row2 | column3row2 |
因此数据使用管道作为行和字段终止符。我只是不知道如何解决它。
Delete from Nations
GO
CREATE TABLE dbo.TempImport
(
id varchar(50),
ruler varchar(50),
name varchar(50),
alliance varchar(50),
alliance_id varchar(50),
alliance_date varchar(50),
alliance_status varchar(50),
govt_type varchar(50),
religion varchar(50),
team varchar(50),
created varchar(50),
tech varchar(50),
infra varchar(50),
land varchar(50),
war_status varchar(50),
resource1 varchar(50),
resource2 varchar(50),
ns varchar(50),
defcon varchar(50),
soliders varchar(50),
tanks varchar(50),
cruise varchar(50),
nuke varchar(50)
)
GO
BULK INSERT dbo.TempImport FROM 'C:\VEDataImport\CyberNations_SE_Nation_Stats\CyberNations_SE_Nation_Stats.txt' WITH (FIELDTERMINATOR = '|', ROWTERMINATOR = '\r\n', FIRSTROW=2)
GO
INSERT INTO dbo.nations
(
id,
ruler,
name,
alliance,
alliance_id,
alliance_date,
alliance_status,
govt_type,
religion,
team,
created,
tech,
infra,
land,
war_status,
resource1,
resource2,
ns,
defcon,
soliders,
tanks,
cruise,
nuke
)
SELECT id,
ruler,
name,
alliance,
alliance_id,
alliance_date,
alliance_status,
govt_type,
religion,
team,
created,
tech,
infra,
land,
war_status,
resource1,
resource2,
ns,
defcon,
soliders,
tanks,
cruise,
nuke
FROM dbo.TempImport
where alliance_id ='10010'
GO
DROP TABLE dbo.TempImport
GO
INSERT INTO dbo.nations
(link
)
SELECT 'http://www.cybernations.net/nation_drill_display.asp?Nation_ID='+id
from dbo.nations