我创建了一个存储过程,如下所示,
CREATE PROCEDURE [dbo].[Access_GetDate]
(
@Name varchar(255)
)
AS
SELECT TOP(1) Employee.StartDate
FROM Employee
WHERE Employee.Name = @Name;
它工作正常,但以这种格式返回日期
2012-10-24 00:00:00.000
但是我想用这种格式,
2012 10 24
仅
答案 0 :(得分:3)
您可以使用以下内容:
USE [DBNAME]
GO
CREATE PROCEDURE [dbo].[Access_GetDate]
(
@Name varchar(255)
)
AS
SELECT TOP(1) replace(convert(char(10), Employee.StartDate, 120), '-', ' ') StartDate
FROM Employee
WHERE Employee.Name = @Name;