2012-12-26 151 views

回答

0

两种临时表可用。一个是基于会话的,另一个是全局临时表。

下面是简单的例子:

Select A,b,c into #MyTemp From MyDbTable 

在上面的例子中,#myTemp是要创建临时表。 MyDbTable是数据库中存在的一个。您可以创建多个临时表。

我建议从这里阅读文章:Link

0
--Create a temp table and insert all these counts in it 
    Create Table #OperatorReportCount(Id int identity,Particulars varchar(100),NoOfArticles int) 

    --Insert these values in table 
    Insert Into #OperatorReportCount(Particulars,NoOfArticles) Values('Articles processed',@ProcessedArticleCount) 
    Insert Into #OperatorReportCount(Particulars,NoOfArticles) Values('Articles approved',@ArticlesApproved) 
    Insert Into #OperatorReportCount(Particulars,NoOfArticles) Values('Articles rejected',@ArticleRejectedCount) 
    Insert Into #OperatorReportCount(Particulars,NoOfArticles) Values('Rejections recieved',@RejectionsRecievedCount) 
    Insert Into #OperatorReportCount(Particulars,NoOfArticles) Values('Articles put on hold',@ArticlesOnHoldCount) 

    --Select the operator count table 
    Select Particulars,NoOfArticles From #OperatorReportCount