Teradata: How to query the data source's name
up vote
0
down vote
favorite
Is it possible to query the current connection's data source name in teradata? I was hoping to use it to tailor some queries so that they could automatically update certain parts of said queries based on the connection information.
For example, a table in our test environment would have a different suffix than the same table in the production environment. The intent would be to use the same query in both environments, so it would need to be able to discern the current connection data in order to append the appropriate suffix to the table name.
I tried to get this from DBC.SessionInfoV
in the LogonSource
field, as per this answer, but there does not appear to be any pattern between the logon strings that discerns the test environment from the production one - it looks like the strings are simply random.
Here you can see what information I'm looking to actually pull into my query.
teradata
add a comment |
up vote
0
down vote
favorite
Is it possible to query the current connection's data source name in teradata? I was hoping to use it to tailor some queries so that they could automatically update certain parts of said queries based on the connection information.
For example, a table in our test environment would have a different suffix than the same table in the production environment. The intent would be to use the same query in both environments, so it would need to be able to discern the current connection data in order to append the appropriate suffix to the table name.
I tried to get this from DBC.SessionInfoV
in the LogonSource
field, as per this answer, but there does not appear to be any pattern between the logon strings that discerns the test environment from the production one - it looks like the strings are simply random.
Here you can see what information I'm looking to actually pull into my query.
teradata
Did you consider my servername UDF answer? Btw, yout shouldn't use those old deprecated non-V-views anymore, it's dbc.SessionInfoV
– dnoeth
Nov 8 at 17:50
@dnoeth Thanks for the heads up on the deprecated views. Unfortunately, I"don't have CREATE FUNCTION access to database SYSLIB"
– Marcucciboy2
Nov 8 at 18:07
1
Ask your DBA to create it for you. Or ask him to give youCreate Function
rights in your user. Of course, the DBA will refuse your request immediatly, he usually grants that right only to a very limited number of admin/super users, because it's for any kind of UDF including C-UDFs and that's too risky. But it's safe when you got 0 perm space (like any normal end user), as SQL UDFs only consist of SQL source code and don't need perm (but C-UDF do). Socreate function
on a user with perm space 0 effectively allows SQL-UDFs only :-)
– dnoeth
Nov 8 at 18:24
@dnoeth haha okay I'll see if it ends up being viable, thanks for the suggestions!
– Marcucciboy2
Nov 8 at 18:47
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Is it possible to query the current connection's data source name in teradata? I was hoping to use it to tailor some queries so that they could automatically update certain parts of said queries based on the connection information.
For example, a table in our test environment would have a different suffix than the same table in the production environment. The intent would be to use the same query in both environments, so it would need to be able to discern the current connection data in order to append the appropriate suffix to the table name.
I tried to get this from DBC.SessionInfoV
in the LogonSource
field, as per this answer, but there does not appear to be any pattern between the logon strings that discerns the test environment from the production one - it looks like the strings are simply random.
Here you can see what information I'm looking to actually pull into my query.
teradata
Is it possible to query the current connection's data source name in teradata? I was hoping to use it to tailor some queries so that they could automatically update certain parts of said queries based on the connection information.
For example, a table in our test environment would have a different suffix than the same table in the production environment. The intent would be to use the same query in both environments, so it would need to be able to discern the current connection data in order to append the appropriate suffix to the table name.
I tried to get this from DBC.SessionInfoV
in the LogonSource
field, as per this answer, but there does not appear to be any pattern between the logon strings that discerns the test environment from the production one - it looks like the strings are simply random.
Here you can see what information I'm looking to actually pull into my query.
teradata
teradata
edited Nov 8 at 18:47
asked Nov 8 at 17:30
Marcucciboy2
2,31621022
2,31621022
Did you consider my servername UDF answer? Btw, yout shouldn't use those old deprecated non-V-views anymore, it's dbc.SessionInfoV
– dnoeth
Nov 8 at 17:50
@dnoeth Thanks for the heads up on the deprecated views. Unfortunately, I"don't have CREATE FUNCTION access to database SYSLIB"
– Marcucciboy2
Nov 8 at 18:07
1
Ask your DBA to create it for you. Or ask him to give youCreate Function
rights in your user. Of course, the DBA will refuse your request immediatly, he usually grants that right only to a very limited number of admin/super users, because it's for any kind of UDF including C-UDFs and that's too risky. But it's safe when you got 0 perm space (like any normal end user), as SQL UDFs only consist of SQL source code and don't need perm (but C-UDF do). Socreate function
on a user with perm space 0 effectively allows SQL-UDFs only :-)
– dnoeth
Nov 8 at 18:24
@dnoeth haha okay I'll see if it ends up being viable, thanks for the suggestions!
– Marcucciboy2
Nov 8 at 18:47
add a comment |
Did you consider my servername UDF answer? Btw, yout shouldn't use those old deprecated non-V-views anymore, it's dbc.SessionInfoV
– dnoeth
Nov 8 at 17:50
@dnoeth Thanks for the heads up on the deprecated views. Unfortunately, I"don't have CREATE FUNCTION access to database SYSLIB"
– Marcucciboy2
Nov 8 at 18:07
1
Ask your DBA to create it for you. Or ask him to give youCreate Function
rights in your user. Of course, the DBA will refuse your request immediatly, he usually grants that right only to a very limited number of admin/super users, because it's for any kind of UDF including C-UDFs and that's too risky. But it's safe when you got 0 perm space (like any normal end user), as SQL UDFs only consist of SQL source code and don't need perm (but C-UDF do). Socreate function
on a user with perm space 0 effectively allows SQL-UDFs only :-)
– dnoeth
Nov 8 at 18:24
@dnoeth haha okay I'll see if it ends up being viable, thanks for the suggestions!
– Marcucciboy2
Nov 8 at 18:47
Did you consider my servername UDF answer? Btw, yout shouldn't use those old deprecated non-V-views anymore, it's dbc.SessionInfoV
– dnoeth
Nov 8 at 17:50
Did you consider my servername UDF answer? Btw, yout shouldn't use those old deprecated non-V-views anymore, it's dbc.SessionInfoV
– dnoeth
Nov 8 at 17:50
@dnoeth Thanks for the heads up on the deprecated views. Unfortunately, I
"don't have CREATE FUNCTION access to database SYSLIB"
– Marcucciboy2
Nov 8 at 18:07
@dnoeth Thanks for the heads up on the deprecated views. Unfortunately, I
"don't have CREATE FUNCTION access to database SYSLIB"
– Marcucciboy2
Nov 8 at 18:07
1
1
Ask your DBA to create it for you. Or ask him to give you
Create Function
rights in your user. Of course, the DBA will refuse your request immediatly, he usually grants that right only to a very limited number of admin/super users, because it's for any kind of UDF including C-UDFs and that's too risky. But it's safe when you got 0 perm space (like any normal end user), as SQL UDFs only consist of SQL source code and don't need perm (but C-UDF do). So create function
on a user with perm space 0 effectively allows SQL-UDFs only :-)– dnoeth
Nov 8 at 18:24
Ask your DBA to create it for you. Or ask him to give you
Create Function
rights in your user. Of course, the DBA will refuse your request immediatly, he usually grants that right only to a very limited number of admin/super users, because it's for any kind of UDF including C-UDFs and that's too risky. But it's safe when you got 0 perm space (like any normal end user), as SQL UDFs only consist of SQL source code and don't need perm (but C-UDF do). So create function
on a user with perm space 0 effectively allows SQL-UDFs only :-)– dnoeth
Nov 8 at 18:24
@dnoeth haha okay I'll see if it ends up being viable, thanks for the suggestions!
– Marcucciboy2
Nov 8 at 18:47
@dnoeth haha okay I'll see if it ends up being viable, thanks for the suggestions!
– Marcucciboy2
Nov 8 at 18:47
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53213188%2fteradata-how-to-query-the-data-sources-name%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you consider my servername UDF answer? Btw, yout shouldn't use those old deprecated non-V-views anymore, it's dbc.SessionInfoV
– dnoeth
Nov 8 at 17:50
@dnoeth Thanks for the heads up on the deprecated views. Unfortunately, I
"don't have CREATE FUNCTION access to database SYSLIB"
– Marcucciboy2
Nov 8 at 18:07
1
Ask your DBA to create it for you. Or ask him to give you
Create Function
rights in your user. Of course, the DBA will refuse your request immediatly, he usually grants that right only to a very limited number of admin/super users, because it's for any kind of UDF including C-UDFs and that's too risky. But it's safe when you got 0 perm space (like any normal end user), as SQL UDFs only consist of SQL source code and don't need perm (but C-UDF do). Socreate function
on a user with perm space 0 effectively allows SQL-UDFs only :-)– dnoeth
Nov 8 at 18:24
@dnoeth haha okay I'll see if it ends up being viable, thanks for the suggestions!
– Marcucciboy2
Nov 8 at 18:47