Solved

Fake Table

Posted on 2011-09-27
2
178 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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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 INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

622 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