我正在尝试将#include <stdio.h>
#include <stdlib.h>
float triangleArea (float base, float height)
{
float area;
area = (base * height) / 2;
return (area);
}
float trianglePerimeter (float side1, float side2, float side3)
{
float perimeter;
perimeter = side1 + side2 + side3;
return (perimeter);
}
int main(int argc, char *argv[])
{
char select;
float input1, input2, input3, output;
do {
printf("Type A for Area \n");
printf("Type P for Perimeter \n");
printf("Type S to stop \n");
printf("Input: ");
scanf("%c", &select);
switch (select) {
case 'A' :
printf("Input base: ");
scanf("%f", &input1);
printf("Input height: ");
scanf("%f", &input2);
output = triangleArea(input1, input2);
printf("Area: %.2f \n", output);
break;
case 'P' :
printf("Input all 3 sides: \n");
scanf("%f%f%f", &input1, &input2, &input3);
output = trianglePerimeter(input1, input2, input3);
printf("Perimeter: %.2f \n", output);
break;
case 'S' :
printf("END \n");
break;
}
printf("\n");
} while (select != 'S');
getchar();
return 0;
}
文件批量加载到SQL Server 2014 Express中。一般来说,通过StackOverflow和Google搜索,每个人似乎都同意这是.csv
文件中几列的问题。不幸的是,没有一个答案对我有用。所以我只能假设我做错了什么,因为即使我创建的简单的2列表也没有用。
我的测试表:
.csv
我的测试数据:
CREATE TABLE [dbo].[TempC1C2]
(
[c1] [nchar](10) NULL,
[c2] [nchar](10) NULL
) ON [PRIMARY]
我的加载脚本:
First,Last
Error.log输出:
Bulk Insert TempC1C2 From
'C:\test.csv'
With(datafiletype='native', FieldTerminator =',', rowterminator='\r\n', errorfile='C:\error.log')
error.log.Error.txt
First,Last
Fi
答案 0 :(得分:0)
我认为您的rowterminator
错了 - 使用\r\n
:
BULK INSERT TempC1C2
FROM 'C:\test.csv'
WITH (datafiletype='native',
fieldTerminator =',',
rowterminator='\r\n',
errorfile='C:\error.log')