USE [BeautySalon]
GO
/****** 对象: Table [dbo].[SYSSequentialId] 脚本日期: 08/29/2013 10:38:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SYSSequentialId](
[RowGuid] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF__SYSGenera__RowGu__045C434E] DEFAULT (newsequentialid()),
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[HelperId] [tinyint] NOT NULL,
CONSTRAINT [PK_SYSGenerateId] PRIMARY KEY CLUSTERED
(
[RowGuid] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: 得到顺序的GUID 此方法优于newid()生成的guid
-- =============================================
alter PROCEDURE SYSSequentialId_GetSequentialId
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO SYSSequentialId(HelperId)VALUES(1)
SELECT TOP 1 RowGuidCol FROM SYSSequentialId WHERE Id=(SELECT SCOPE_IDENTITY())
END
GO