Temporary Tables

The simple answer is yes you can. Let look at a simple CREATE TABLE statement:

YakID int,
YakName char(30) )

Temporary tables are created in tempdb. If you run this query:

YakID int,
YakName char(30) )

select name
from tempdb..sysobjects 
where name like '#yak%'

drop table #yaks

Another Example

CREATE TABLE #TibetanYaks(
YakID int,
YakName char(30) )

INSERT INTO #TibetanYaks (YakID, YakName)
SELECT 	YakID, YakName
FROM 	dbo.Yaks
WHERE 	YakType = 'Tibetan'

-- Do some stuff with the table

drop table #TibetanYaks

Table Variables

If you are using SQL Server 2000 or higher, you can take advantage of the new TABLE variable type. These are similar to temporary tables except with more flexibility and they always stay in memory.  The code above using a table variable might look like this:

DECLARE @TibetanYaks TABLE (
YakID int,
YakName char(30) )

INSERT INTO @TibetanYaks (YakID, YakName)
SELECT 	YakID, YakName
FROM 	dbo.Yaks
WHERE 	YakType = 'Tibetan'

-- Do some stuff with the table


DECLARE @TibetanYaks TABLE (
YakID int,
YakName char(30) )

INSERT INTO @TibetanYaks (YakID, YakName)
SELECT 	YakID, YakName
FROM 	dbo.Yaks
WHERE 	YakType = 'Tibetan'

UPDATE 	@TibetanYaks
SET 	YakName = UPPER(YakName)

FROM @TibetanYaks

Global Temporary Tables

You can also create global temporary tables. These are named with two pound signs. For example, ##YakHerders is a global temporary table. Global temporary tables are visible to all SQL Server connections. When you create one of these, all the users can see it.  These are rarely used in SQL Server.


That shows you an example of creating a temporary table, modifying it, and returning the values to the calling program. I hope this gives you what you were looking for.

Based on: http://www.sqlteam.com/article/temporary-tables

A great guide for learning SQL from the start, from Udemy:


What Wikipedia has to say about UDemy:

Udemy.com is a platform or marketplace for online learning. Unlike academic MOOC programs driven by traditional collegiate coursework, Udemy provides a platform for experts of any kind to create courses which can be offered to the public, either at no charge or for a tuition fee.[1]Udemy provides tools which enable users to create a course, promote it and earn money from student tuition charges.

In addition to SQL You will find there also the following tutorials:


Database good practice

  1. Tools to use:
    1. SSMS – sql server management studio
    2. Visual Studio
  2. The following video is the best to describe the process
    1. How To Create a Database Deployment Project in 10 minutes
    2. In short:
      1. Using VisualStudio connect to Database.
      2. Right click on the DB and select create new project.
        1. At this point there are schemes without data.
  3. The following links explains how to generate script of database with data
    1. Auto-generate INSERT statements for a SQL Server table
  4. The following script explains how to create Visual studio first time database project:
    1. Create Your First Visual Studio Database Project

Creating A New Database Project

Microsoft SQL Server Analysis Services, SSAS, is an online analytical processing (OLAP) and data mining tool inMicrosoft SQL Server. SSAS is used as a tool by organizations to analyze and make sense of information possibly spread out across multiple databases, or in disparate tables or files. Microsoft has included a number of services in SQL Server related to business intelligence and data warehousing. These services include Integration Services, Reporting Services and Analysis Services. Analysis Services includes a group of OLAP and data mining capabilities and comes in two flavors – Multidimensional and Tabular (from wikipedia).

Learn SSAS: PDF, Videos and Demo files:

01. Download SSAS Tutorials PDF file from Microsoft
02. Adventure Works for SQL Server 2012 from CodePlex
03. SSAS 11 Videos of PCTeach.me:
05. 6 Lessons of SSAS MDX
06. 7 Videos of SSAS MDX

SSAS Videos at PCTeach.me:

01. Analysis Services - 01 Prerequisite Guide
02. Analysis Services - 02 Data Source Creation
03. Analysis Services - 03 Data Source Views
04. Analysis Services - 04 Cube Creation
05. Analysis Services - 05 Dimension Fundamentals
06. Analysis Services - 06 Dimension Hierarchies
07. Analysis Services - 07 Dimension Attribute Relationships
08. Analysis Services - 08 Dimension Storage
09. Analysis Services - 09 Dimension Discretization
10. Analysis Services - 10 Parent/Child Dimension Hierachies
11. Analysis Services - 11 Star and Snowflake Schemas