2

I have a pretty extensive Union query with calculated columns that I'm trying to just "paste values" into a table through a separate SELECT INTO query. I get the error below when executing the query. Is there any way around this without using VBA?

“Calculated columns are not allowed in SELECT INTO statements.”

For context: Normally, I'd be able to link up to the union query through PowerPivot in Excel but for some reason PowerPivot does not recognize the union query. If I export the union query then import as a table, PowerPivot recognizes it.

plankton
  • 369
  • 5
  • 21
  • @HansUp Are you referring to the SELECT INTO query or the source query that I want in a table? – plankton May 14 '15 at 15:49
  • @HansUp "Is this like what you have?: You have Query1 which is a UNION query. And other query, Query2, which is a SELECT INTO query intended to save the results from Query1 as a new table. Query1 runs without error, but Query2 throws the error." EXACTLY! – plankton May 14 '15 at 16:01
  • OK. So if you create an empty table with with appropriate fields to receive the values returned by *Query1*, can you then run an "append query" to load the *Query1* results into that table? `INSERT INTO YourTable () SELECT FROM Query1` – HansUp May 14 '15 at 16:08
  • @HansUp It worked! Sorry for the delay. It's a complex query. Thanks for your help. – plankton May 14 '15 at 16:48

1 Answers1

2

Thanks to @HansUp for the help.

I set up a blank table with the appropriate headers from the UNION query and used an INSERT INTO query rather than a SELECT INTO to get the UNION query data into the table.

plankton
  • 369
  • 5
  • 21