Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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 2005 SQL Server 2005中的Convert关键字_Sql Server 2005_Datetime - Fatal编程技术网

Sql server 2005 SQL Server 2005中的Convert关键字

Sql server 2005 SQL Server 2005中的Convert关键字,sql-server-2005,datetime,Sql Server 2005,Datetime,我想转换一个DATETIME字段(DateOfBirth)。。。当我执行下面的查询时,它表示convert附近的语法无效 SELECT e.Emp_Id,e.Emp_Name,e.Address,e.Department, (convert(varchar, e.Date_Of_Birth, 103) as Date_Of_Birth) from Employee as e 但当我执行下面的查询时,它会给出结果,但我的dateofbirth列名是(无列名) 为什么我不能给转换函数指定别名作为

我想转换一个
DATETIME
字段(DateOfBirth)。。。当我执行下面的查询时,它表示convert附近的语法无效

SELECT e.Emp_Id,e.Emp_Name,e.Address,e.Department,
(convert(varchar, e.Date_Of_Birth, 103) as Date_Of_Birth) from Employee as e 
但当我执行下面的查询时,它会给出结果,但我的dateofbirth列名是(无列名)

为什么我不能给转换函数指定别名作为列名?

删除多余的逗号:

SELECT e.Emp_Id,e.Emp_Name,e.Address,e.Department, 
convert(varchar, e.Date_Of_Birth, 103) as Date_Of_Birth
FROM Employee as e  

@米奇:对不起,那是我的编辑错误。。查看我编辑的问题我发布的查询是否有效(注意:删除了附加括号)?
SELECT e.Emp_Id,e.Emp_Name,e.Address,e.Department, 
convert(varchar, e.Date_Of_Birth, 103) as Date_Of_Birth
FROM Employee as e