Tuesday, September 18, 2012

ID

declare @IDs varchar(max)='1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39'

select * from tblGIN

where @IDs is null or ',' + REPLACE(@IDs,' ','') + ','like '%,'+CAST(numGINID as nvarchar(max))+',%'

------------------------------------------------------------------------------------------------

create procedure samplesp

(

@IDs nvarchar(max)

)

as

begin

select * from tblGIN

where @IDs is null or ',' + REPLACE(@IDs,' ','') + ','like '%,'+CAST(numGINID as nvarchar(max))+',%'

end

-----------------------------------------------------------------

----------

 bulk inset into temptable 2ways use in real time



 method 1:

select * into #temp123 from tblGIN

select * from #temp123

drop table #temp123

method: 2

Create table #tempemp(id int,empname varchar(50))

insert into #tempemp

select id,empname from tableEmp

select * from #tempemp

drop table #tempemp

 

No comments:

Post a Comment