Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Fake Table

Posted on 2011-09-27
2
Medium Priority
?
183 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
2 Comments
 
LVL 21

Accepted Solution

by:
JestersGrind earned 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
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 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…

926 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