--newid () can automatically generate columns at query time Guid
select top 10 *,newid() as Random from ywle where ywlename='001' ordey by Random
- Create the corresponding column with the uniqueidentifier type
IF NOT EXISTS ( SELECT * FROM dbo.SysObjects WHERE ID = object_id(N'[RMA_ExchangeOrderAddTempInfo]') AND OBJECTPROPERTY(ID, 'IsTable') = 1 ) BEGIN SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE TABLE [dbo].[RMA_ExchangeOrderAddTempInfo]( [Id] [int] IDENTITY(1,1) NOT NULL, RandNum uniqueidentifier NULL, ) END GO
/// <Summary> /// random number as a primary key (received and transmitted in the background with reference Guid type) /// </ Summary> public Guid randnum { GET ; SET ;}