/* ------------------------ My Meta Content Here SEO ------------------------ */

Pages

Main Menu




Wednesday, May 21, 2014

Creating temporary table in sql server

Here is the use of temporary table inside a stored procedure: 

create procedure [dbo].[usp_CreatingTemporaryTable]
as 
begin
--creating temporary table here
create table #temp
(
name varchar(50),
address varchar(150)
)

--select * from yourtablename
insert into #temp select column1, column2 from yourtablename 

select distinct column1 from #temp
select * from #temp
end
--Finally drop temporary table
drop table #temp

No comments:

Post a Comment

Recent Posts

My Blog List