• sql server 与oracle区别


    oracle和sqlserver不同
    --------------------------------------------
    1.case when

    eg:

    oracle:
    SELECT (
    CASE WHEN Org_type= 1 THEN ( SELECT Name1 FROM Company_Master WHERE Org_ID =1 )
    WHEN Org_type= 2 THEN ( SELECT Name1 FROM Company_Master WHERE Org_ID =1 )
    WHEN Org_type= 3 THEN ( SELECT Name1 FROM Company_Master WHERE Org_ID =1 )
    ELSE to_nchar('1') END
    ) AS Name1
    FROM Organization_Master WHERE Org_ID = 1


    sql server:
    SELECT (
    CASE WHEN Org_type= 1 THEN ( SELECT Name1 FROM Company_Master WHERE Org_ID =1 )
    WHEN Org_type= 2 THEN ( SELECT Name1 FROM Company_Master WHERE Org_ID =1 )
    WHEN Org_type= 3 THEN ( SELECT Name1 FROM Company_Master WHERE Org_ID =1 )
    ELSE '1' END
    ) AS [Name1]
    FROM Organization_Master WHERE Org_ID = 1

    区别:1.在oracle里面如果THEN后边的类型和ELSE后面的类型不一致,需要用函数转化(具体用什么函数,要根据具体情况而定,比如to_char和to_nchar等)比如: to_nchar('1'),    在 sqlserver中则不需要

       2.在oracle中AS后边的列名不用加任何符号如:AS Name1,在sqlserver中需要用AS [Name1]
    ------------------------------------------------------
    2.top 不同
    oracle
    select * from User_Master where rownum<=10

    sqlserver

    select top 10* from User_Master

    区别:注:oracle里面不支持top只能变成where条件语句

  • 相关阅读:
    Robot Framework (十)html基础
    Robot Framework (九)Selenium的安装
    Robot Framework (八)循环&分支
    Robot Framework (七)Keyword 关键字
    约瑟夫环问题的两种解法(详解)
    msdn
    java同一个包中,类之间的的调用
    循环语句中break 与 continue的区别
    memset()函数
    DFS(深搜)算法
  • 原文地址:https://www.cnblogs.com/avrilliu/p/2999702.html
Copyright © 2020-2023  润新知