SQL 相关

SET STATISTICS TIME ON

记录查询的相关数据


生成随机Guid

SELECT NewID()

按照某一列排序并生成序号

select
Row_Number() OVER (ORDER BY Name) [Index]
,Name,ID
,NewID() RandomCode
from Users

Over后面的括号中就是排序的语句 可以写 Order By XXX 或 Order By OOO Desc


--判断存储过程是否存在
IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[P_EF_ExpertInvalidStatistic]') AND
        OBJECTPROPERTY(ID, N'ISPROCEDURE') = 1)
    DROP PROCEDURE P_EF_EXPERTINVALIDSTATISTIC
GO

--判断表是否存在
IF EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[tb_Emp_InvalidExpert]') AND
        OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE tb_Emp_InvalidExpert
GO

上一篇:Android学习总结——SQLite


下一篇:解决Vsphere Client 60天过期问题