如何将Excel的日期格式转换为Sql日期格式? [英] How to convert Date format of Excel to Sql Date format?

查看:759
本文介绍了如何将Excel的日期格式转换为Sql日期格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有学生出勤率Excel我在上个月的最后一天填写学生的出勤细节我在数据库中上传了excel表。当上传excel表时我收到此错误

I have Student Attendance Excel in Which I filling attendance detail of student at last of month I upload that excel sheet in database.When uploading excel sheet I getting this error

Error Uploading all Records.Object reference not set to an instance of an object

推荐答案

函数SQLDate(d)

SQLDate = WorksheetFunction。文字(d,yyyy-mm-dd hh:MM:ss)

结束功能





或者



如果登台表是一个选项,你可以使用

TEXT将日期转换为字符串(d,dd mmmm yyyy HH:MM:SS)。一旦数据在临时表中,您可以编写适当的SQL语句以插入到正确的表中。
Function SQLDate(d)
SQLDate = WorksheetFunction.Text(d, "yyyy-mm-dd hh:MM:ss")
End Function


or else

if staging table is an option, you could convert Excel date to string using
TEXT(d,"dd mmmm yyyy hh:mm:ss"). once the data is in staging table, you may write appropriate SQL statement to insert into correct table.


这篇关于如何将Excel的日期格式转换为Sql日期格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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