将数据从一个表插入另一个表时发生冲突错误 [英] Violation errors while inserting data from one table into another

查看:88
本文介绍了将数据从一个表插入另一个表时发生冲突错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在一张桌子上插入记录时遇到错误。



这些是结构两个表:

file51tm_new


RecordType文本

RecordNumber数字

WorkCOde Text

日期文本

Tck_nbr文本

时间文本

transno文本

Start_date Text

End_date TEXT

Tk_serial文字

tck_price text

void_code text

mag_encode text

red_date text

red_time text

批号


>
RecordType文件

RecordNumber数字

WorkCOde文件

日期/时间

Tck_nbr number

时间文本

transno号码

tck_type号码

Start_date日期/时间

End_date日期/时间

Tk_serial text

tck_price number

void_code text

mag_encode文字

red_date日期/时间

red_time文本

批号



这是查询:

Hi,

I am getting errors while inserting records in one table from another.


These are the structures of two tables :

file51tm_new

RecordType Text
RecordNumber Number
WorkCOde Text
Date TExt
Tck_nbr Text
time text
transno text
Start_date Text
End_date TExt
Tk_serial Text
tck_price text
void_code text
mag_encode text
red_date text
red_time text
batch number

file51tm_new_1

RecordType Text
RecordNumber Number
WorkCOde Text
Date date/time
Tck_nbr number
time text
transno number
tck_type number
Start_date date/time
End_date date/time
Tk_serial text
tck_price number
void_code text
mag_encode text
red_date date/time
red_time text
batch number


And this is the query :

展开 | 选择 | Wrap | 行号

推荐答案

你的问题是你的约会。您正在尝试将文本转换为日期/时间


例如,


IIf([Date]<>"" ,[日期],")AS Expr1


应该是


IIf([日期]<>"" ;,格式([日期],dd / mm / yy,空)AS Expr1


我使用了欧洲日期格式,但您可以使用适合的格式您的数据库。


对其他日期遵循相同的规则。如果为false,则不能对值使用",因为这是一个字符串,所以我使用了Null。
Your problem is with your dates. You are trying to convert text to date/time

For example,

IIf([Date]<>"",[Date],"") AS Expr1

Should be

IIf([Date]<>"",Format([DATE], "dd/mm/yy",Null) AS Expr1

I''ve used european date format but you can use whichever format is suitable to your database.

Follow the same rules for the other dates. You cannot use "" for the value if false as this is a string, so I''ve used Null.


我试过这个选项,但我仍然得到同样的错误.....


I tried this option, but I still get the same error.....




您的问题与您的日期有关。您正在尝试将文字转换为日期/时间


例如,


IIf([日期]<>"",[日期],"")AS Expr1


应该是


IIf([Date]<>"",Format([DATE]," ; dd / mm / yy",Null)AS Expr1


我使用过欧洲日期格式,但您可以使用适合您数据库的格式。


遵循其他日期的相同规则。你不能使用。对于值为false,因为这是一个字符串,所以我使用了Null。
Your problem is with your dates. You are trying to convert text to date/time

For example,

IIf([Date]<>"",[Date],"") AS Expr1

Should be

IIf([Date]<>"",Format([DATE], "dd/mm/yy",Null) AS Expr1

I''ve used european date format but you can use whichever format is suitable to your database.

Follow the same rules for the other dates. You cannot use "" for the value if false as this is a string, so I''ve used Null.



我试过这个选项,但我仍然得到同样的错误.....
I tried this option, but I still get the same error.....



您是否为所有日期字段执行此操作?

Did you do this for all date fields?


这篇关于将数据从一个表插入另一个表时发生冲突错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆