Solved

SQL: Create Table

Posted on 2011-03-01
2
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Assisted Solution

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

Accepted Solution

by:
Ephraim Wangoya earned 250 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

696 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