SQL 2000 Query?


I'd like to know if this Query is based on Ansi-89.
If the query is old:  how I could change to ANSI-92?

SELECT  tUseOCode = left((SELECT IsNull(InstTSigla,InstTDescrip) + '-' + IsNull(UorgTSigla,UOrgTDescrip) + '-' + IsNull(PerTDescrip,'')
                              FROM   oeimInstitucion a, oeimUnidOrg b, SIUsuario c, oeimPersonal d
                             WHERE c.UsrCCod = M.cUseOCode
                               AND c.UsrCCodper = d.PerCCod
                               AND d.PerCCoduorg = b.UorgCCod
                               AND b.UorgCCodInst = a.InstCCod), 100),
          convert(varchar(10),M.dRegiDate,103) + ' ' + convert(varchar,M.dRegiDate,108) as dRegiDate
     FROM Movimiento M
    order By M.cMoviCode desc

Open in new window

I'd really appreciate your help.
JnavarroMcIT ConsultantAsked:
Who is Participating?
ste5anSenior DeveloperCommented:

SELECT  LEFT((  SELECT  ISNULL(InstTSigla,InstTDescrip) + '-' + ISNULL(UorgTSigla,UOrgTDescrip) + '-' + ISNULL(PerTDescrip,'')
                FROM    SIUsuario c
                    INNER JOIN oeimPersonal d ON c.UsrCCodper = d.PerCCod
                    INNER JOIN oeimUnidOrg b ON d.PerCCoduorg = b.UorgCCod
                    INNER JOIN oeimInstitucion a ON b.UorgCCodInst = a.InstCCod
                WHERE c.UsrCCod = M.cUseOCode
            ), 100) AS tUseOCode,
        CONVERT(VARCHAR(10),M.dRegiDate,103) + ' ' + CONVERT(VARCHAR,M.dRegiDate,108) AS dRegiDate
FROM Movimiento M

Open in new window

But you should use the table alias name for all columns.
Vitor MontalvãoMSSQL Senior EngineerCommented:
CONVERT isn't an ANSI function, so your query won't run in another DBMS besides SQL Server.
To answer your question, the query is neither ANSI-89 nor ANSI-92 compatible.
JnavarroMcIT ConsultantAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.