标签:des style blog http color io ar 数据 sp
创建用到的表的SQL
CREATE TABLE [dbo].[emp_pay](
[employeeID] [int] NOT NULL,
[base_pay] [money] NOT NULL,
[commission] [decimal](2, 2) NOT NULL
) ON [PRIMARY]
生成的表,及表中的数据:
--方法一 select top 1 * from ( SELECT TOP 2 * FROM [dbo].[emp_pay] WHERE base_pay = 500 order by employeeID ASC) as a --注意:派生表后面一定要指定别名. order by a.employeeID DESC
--方法二 select IDENTITY(int,1,1) ID,* INTO #Temp from [dbo].[emp_pay] where base_pay = 500 select * from #Temp where ID =2 drop Table #Temp
--方法三 set rowcount 2 SELECT * into #t from [dbo].[emp_pay] where base_pay = 500 set rowcount 1 delete from #t select * from #t set rowcount 0 drop table #t
标签:des style blog http color io ar 数据 sp
原文地址:http://www.cnblogs.com/hellolong/p/4001797.html