Archives of the TeradataForum
Message Posted: Wed, 15 May 2013 @ 19:50:52 GMT
In SQL Assistant, is there a way to define a variable in such a way that its value is used in a query?
I know I can use a "prompt" to get one value, but is there a way to use that same prompt more than once?
As a trivial example, suppose I want to list all the tables in two databases that were created by a given user. I want to do something like this:
select * from DBC.TABLES where DatabaseName = 'my_db1' and CreatorName = ?target_id /* Prompt for user ID */ union select * from DBC.TABLES where DatabaseName = 'my_db2' and CreatorName = @target_id /* Use same value from previous prompt */
I also know this could be done with a macro, but I don't have "CREATE MACRO" permission.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 24 Jul 2020|