Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/147.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 在MS SQL Server中以特定格式插入日期时间_Sql Server - Fatal编程技术网

Sql server 在MS SQL Server中以特定格式插入日期时间

Sql server 在MS SQL Server中以特定格式插入日期时间,sql-server,Sql Server,我想在datetime列中存储datetime格式 我想使用的格式是: 14-05-2012 14:08:54 顺便问一句,以上是可能的吗 原因是我们使用Excel表格从数据库中读取数据,使用这种格式将在日常工作中帮助我们很多 请告知 我感谢你的帮助和回答 Datetime是Datetime,它与任何特定格式都没有关联。如果需要格式化日期时间,请使用: select convert( char(10), getdate(), 105) + ' ' + convert( char(8), get

我想在datetime列中存储datetime格式

我想使用的格式是: 14-05-2012 14:08:54

顺便问一句,以上是可能的吗

原因是我们使用Excel表格从数据库中读取数据,使用这种格式将在日常工作中帮助我们很多

请告知


我感谢你的帮助和回答

Datetime是Datetime,它与任何特定格式都没有关联。如果需要格式化日期时间,请使用:

select convert( char(10), getdate(), 105) +  ' ' + convert( char(8), getdate(), 108)

Datetime是Datetime,它不与任何特定格式关联。如果需要格式化日期时间,请使用:

select convert( char(10), getdate(), 105) +  ' ' + convert( char(8), getdate(), 108)

我不确定是否有一个确切的输出格式为期望的结果。但这是我的工作

SELECT CONVERT(varchar(10), getdate(), 105) 
       + ' ' + CONVERT(varchar(8), GETDATE(), 108)

我不确定是否有一个确切的输出格式为期望的结果。但这是我的工作

SELECT CONVERT(varchar(10), getdate(), 105) 
       + ' ' + CONVERT(varchar(8), GETDATE(), 108)