/* ------------------------ 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

My Blog List

  • काश - काश मुझे भी पीने की आदत होती,मैं कब का मुर्दा हो गया होता। छुटकारा मिलता आज के आतंकवाद से, किसी संतान भूमि में सो गया होता। मेरा एतबार कौन करेगा, मैंने मुर...
    2 months ago
  • काश - काश मुझे भी पीने की आदत होती,मैं कब का मुर्दा हो गया होता। छुटकारा मिलता आज के आतंकवाद से, किसी शमशान भूमि में सो गया होता। मेरा एतबार कौन करेगा, मैंने मुर...
    2 months ago
  • Kumaon University Nainital B.Ed entrance exam test result 2012 - कुमाऊँ विश्वविधालय, नैनीताल (उत्तराखण्ड)
    10 years ago