How do I create an SQL query that returns constant data?
How do I create an SQL query that returns constant data?
Som开发者_StackOverflow社区ething like
select (("col1val1", "col2val1"), ("col1val2", "col2val2"))
SELECT 'col1val1','col2val1'
UNION
SELECT 'col1val2','col2val2'
UNION
SELECT ...etc...
Write a macro to do this for you, do it in Excel (my favorite), or adjust your constraints.
select 'col1val1', 'col2val1'
union
select 'col1val2', 'col2val2'
I don't know why do you want to do that but you could use something like:
Select 'col1val1', 'col2val1', 'col1val2', 'col2val2' from ...
- Create a simple, regular table.
- Insert all data that you want there.
- REMOVE insert, delete and update rights from all relevant loggable accounts (only for that table, of course).
Voilà! Now you have a constant, read-only table!! You can use regular SELECT
s over it, and you'll never be worried by any kind of data change.
Other than that, sorry, your only option will be using SELECT 'BlahBlahBlah' UNION...
...
精彩评论