select top 10000000 identity(int,0,1) sid into # from master..syscolumns,master..sysobjects ,
master.dbo.syscomments
select * from # where right(sid,1)='1'
drop table #
select top 10000000 identity(int,0,1) sid into # from master..syscolumns,master..sysobjects ,
master.dbo.syscomments
select * from # where right(sid,1)=1
drop table #
declare @t table(id int)
declare @i int
set @i=1
while @i<=9999999
begin
insert into @t select @i
set @i=@i+1
end
select * from @t where cast(id as varchar) like '%1%'