sql server实现无序不重复的序列

是用newID()方法即可产生

//转换为字符串
SELECT CONVERT(char(266),@myid) AS 'char';

//转为为numeric
--SELECT CONVERT(numeric(19,0),BINARY_CHECKSUM(NEWID())) AS 'numeric';

--GO

//row_number

select row_number()over(order by @@spid),* from cp

你可能感兴趣的:(SQL Server)