Hey folks! I’m looking at the <SESSIONTIMEZONE> f...
# suiteql
n
Hey folks! I’m looking at the SESSIONTIMEZONE function in SQL. What I’m confused about is, time zone is set on Subsidiary right, and per user right? So if I am to run this in a query in a script executed in the context of my user, it uses my set time zone. But if I run it in a query in for example a scheduled script, what subsidiary’s timezone would be returned?
w
Timezone for the instance/system is set on Setup -> Company -> Company Information As far as I can tell, if a script is executed in the users context, then SESSIONTIMEZONE will give you what the user has in their preferences. If a script is executed as
- System -
it will give you the timezone of the instance/system
n
@Watz ah another place to set the TZ, thanks, that must be it! Will try it out.
b
you were closer the first time
there is a default timezone for the company, and a default timezone for the subsidiary
with the default timezone for the subsidiary taking precedence over the company
if your script runs using the system user, then its subsidiary will be your parent subsidiary, and if that subsidiary has a default timezone defined, then the script will be the default time zone defined on the subsidiary
🙏 1
that assuming the user running the map/reduce is actually the system user, its possible for a map/reduce to be run using different users
n
@battk interesting, how does one set user to run M/Rs?
b
N/task is the usual
n
Within the script you mean?
I mean in the case of it being scheduled not triggered by another script
b
the task submitted by N/task will be using the user of whatever script it was run in
the usual map/reduce running on a schedule uses the system user
w
Interesting how the connection between the top parent subsidiary and the company information-page works. Setting the same value on the subsidiary as on the company information-page essentially links/clears the value and the top subsidiary will follow changes from the company information-page. But not the other way around. Good to know that it really is the top parent subsidiary that is the session context for the system-user.
👍 1
🤔 1
b
the vast majority of the time, the two have the same value
they only dont match when someone messes up
w
Luckily, people never mess up. 😂
n
Haha.. thanks for the help guys, nice to learn stuff 🙂