-2

下面的查询以小写的月份返回日期,我需要大写的月份,任何帮助将不胜感激。当前为 2012 年 8 月 8 日,我需要 2012 年 8 月 8 日。

Select 
    RTrim(Right(MTRL.MTRL_NBR, 9)) As MTRL_NBR, 
    RTrim(PROD_ORDR.PROD_ORDR_NBR) As ORDER_NBR, 
    RTrim(PROD_ORDR.BTCH_NBR) As BATCH_NBR, 
    RTrim(PROD_ORDR.RVSN_LVL) As REV_LVL, 
    Convert(VARCHAR(11),PROD_ORDR.ACT_RLSE_DT,106) As RELEASE_DATE 
From 
    MPM.DBO.PROD_ORDR 
Inner Join MPM.DBO.MTRL 
    On PROD_ORDR.MTRL_OID = MTRL.OID 
Where PROD_ORDR.PROD_ORDR_NBR = 000104007817
4

3 回答 3

1
Select  
    RTrim(Right(MTRL.MTRL_NBR, 9)) As MTRL_NBR,  
    RTrim(PROD_ORDR.PROD_ORDR_NBR) As ORDER_NBR,  
    RTrim(PROD_ORDR.BTCH_NBR) As BATCH_NBR,  
    RTrim(PROD_ORDR.RVSN_LVL) As REV_LVL,  
    UPPER(Convert(VARCHAR(11),PROD_ORDR.ACT_RLSE_DT,106)) As RELEASE_DATE  
From  
    MPM.DBO.PROD_ORDR  
Inner Join MPM.DBO.MTRL  
    On PROD_ORDR.MTRL_OID = MTRL.OID  
Where PROD_ORDR.PROD_ORDR_NBR = 000104007817 
于 2012-08-06T04:14:10.553 回答
1

如果您使用 sql server,则可以使用 Upper() 函数

Select RTrim(Right(MTRL.MTRL_NBR, 9)) As MTRL_NBR, 
        RTrim(PROD_ORDR.PROD_ORDR_NBR) As ORDER_NBR, 
        RTrim(PROD_ORDR.BTCH_NBR) As BATCH_NBR, RTrim(PROD_ORDR.RVSN_LVL) As REV_LVL, 
        Upper(Convert(VARCHAR(11),PROD_ORDR.ACT_RLSE_DT,106)) As RELEASE_DATE From MPM.DBO.PROD_ORDR Inner Join MPM.DBO.MTRL On PROD_ORDR.MTRL_OID = MTRL.OID Where PROD_ORDR.PROD_ORDR_NBR = 000104007817
于 2012-08-06T04:16:12.787 回答
0

使用UPPER功能为您完成。

SELECT  RTrim(Right(MTRL.MTRL_NBR, 9)) As MTRL_NBR,  
        RTrim(PROD_ORDR.PROD_ORDR_NBR) As ORDER_NBR,  
        RTrim(PROD_ORDR.BTCH_NBR) As BATCH_NBR,  
        RTrim(PROD_ORDR.RVSN_LVL) As REV_LVL,  
        UPPER(Convert(VARCHAR(11),PROD_ORDR.ACT_RLSE_DT,106)) As RELEASE_DATE  
FROM    MPM.DBO.PROD_ORDR  
           INNER JOIN MPM.DBO.MTRL  
              ON PROD_ORDR.MTRL_OID = MTRL.OID  
WHERE   PROD_ORDR.PROD_ORDR_NBR = 000104007817
于 2012-08-06T04:39:07.577 回答