Solved

Fake Table

Posted on 2011-09-27
2
177 Views
Last Modified: 2012-05-12
I have read only writes in SQLServer '08;
and was wondering if there wasn't a better way to do this:
WITH DUMB_TABLE(QUESTION, ANSWER)
AS
(

SELECT 1,2

UNION

SELECT 3,4

UNION

SELECT 5,6
)

SELECT * FROM DUMB_TABLE

Open in new window

0
Comment
Question by:JustinW
[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 21

Accepted Solution

by:
JestersGrind earned 500 total points
ID: 36710391
There's no need to use a CTE for that.  You get the same result by just using your inner select statement like this.

Greg

SELECT 1 AS QUESTION, 2 AS ANSWER
UNION
SELECT 3,4
UNION
SELECT 5,6
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 36710527
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

734 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