Solved

SQL: Create Table

Posted on 2011-03-01
2
268 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 250 total points
Comment Utility
0
 
LVL 32

Accepted Solution

by:
ewangoya earned 250 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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 setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now