?
Solved

SQL: Create Table

Posted on 2011-03-01
2
Medium Priority
?
281 Views
Last Modified: 2012-05-11
Need to LEFT OUTER JOIN to an imaginary table that I need to create on the fly...kind of like an array.

I attached an Excel sheet of what I need to LEFT OUTER JOIN to.

SELECT R.DisplayName, E.Entered
FROM Resources R LEFT OUTER JOIN ( EXCEL SHEET ) E ON E.RsrcNo = R.RsrcNo
Book1.xlsx
0
Comment
Question by:InfoTechEE
2 Comments
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 1000 total points
ID: 35013651
0
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 1000 total points
ID: 35013653
Use a temp table
declare @Table1 Table(RsrcNo int, DisplayName varchar(20), Entered datetime)

insert into @Table1
select 1743, 'User 1', '6/6/2006'
union all
select 4986, 'User 2', '5/4/2010'
union all
select 1672, 'User 3', '8/18/2006'
union all
select 5100, 'User 4', '3/1/2011'
union all
select 1821, 'User 5', '6/8/2005'
union all
select 4214, 'User 6', '9/25/2006'
union all
select 3623, 'User 7', '4/19/2006'
union all
select 4089, 'User 8', '8/18/2006'

SELECT R.DisplayName, E.Entered
FROM Resources R 
LEFT OUTER JOIN @Table1 E ON E.RsrcNo = R.RsrcNo

Open in new window

0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question