如何将dd / mm / yyyy转换为sql server默认格式(yyyy-mm-dd)....? [英] How to convert dd/mm/yyyy to sql server default format (yyyy-mm-dd)....?

查看:970
本文介绍了如何将dd / mm / yyyy转换为sql server默认格式(yyyy-mm-dd)....?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将dd / mm / yyyy转换为sql server默认格式(yyyy-mm-dd).... ?????





我想要从Excel工作表导入数据到SQL Server 2008 ....这里,我的工作表日期格式是22/05/2014 ......所以,它会抛出一个错误.... .........



从字符串转换日期和/或时间时转换失败



如何解决这个问题...............

解决方案

试试这个:< br $>


在Excel工作表中
1)选择整个日期列。
2)右键单击并找到格式化单元格选项。
3)从格式单元格窗口中选择日期类别。
4)选择lacale为英语(加拿大)。
5选择您的Desire Format并单击Ok。


我自己感谢您的支持

 CONVERT(datetime ,' + g1.Cells [1] .Text +' 105 


How to convert dd/mm/yyyy to sql server default format (yyyy-mm-dd)....?????


I want import data from excel sheet to SQL Server 2008....Here, In my sheet date format is 22/05/2014......So, It throws an Error.............

Conversion failed when converting date and/or time from character string

how to Solve this...............

解决方案

Try this:

In your Excel Sheet 
1)Select the entire Date  column .
2) Right Click and find Format cells Option.
3) Select the Date Catagory From Format Cells Window.
4) Select The lacale as English(canada).
5 Select your Desire Format and click Ok.


I did myself thanks for ur all support

CONVERT(datetime,'" + g1.Cells[1].Text + "',105)


这篇关于如何将dd / mm / yyyy转换为sql server默认格式(yyyy-mm-dd)....?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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