Re: HELP..

From: Tibor Karaszi (tibor.please_reply_to_public_forum.karaszi@cornerstone.se)
Date: 07/12/02


From: "Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@cornerstone.se>
Date: Fri, 12 Jul 2002 08:06:54 +0200


It should be the login that SQLServer is using. If the job owner isn't sysadmin, then Agent
executes the SETUSER command to emulate the owners username context in that database. Perhaps
this is what making it become NULL?

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver"Shamim" <shamim.abdul@railamerica.com> wrote in message news:#nPGqAPKCHA.2688@tkmsftngp11...
>
> Again...what will be the output for a suser_sname() inside  a SP which is
> being executed thru a SQL JOB which is scheduled.
> I tested the above and got a login which is not listed under the logins in
> EnterpriseManager.
>
> Thanks
> Shamim
>
>
> "Shamim" <shamim.abdul@railamerica.com> wrote in message
> news:OfzXykOKCHA.2520@tkmsftngp08...
> > Same code - suser_name() picks data for some server/database while in
> > another its NULL.
> > All databases are in SQL SERVER 7.0
> >
> > Do I have to chk any database settings which is different ???
> >
> > Thanks
> > Shamim
> >
> >
> >
> > "Tibor Karaszi"
> <tibor.please_reply_to_public_forum.karaszi@cornerstone.se>
> > wrote in message news:#uFd3cKKCHA.2548@tkmsftngp11...
> > > ... or, to be ANSI SQL compliant, SYSTEM_USER
> > >
> > > --
> > > Tibor Karaszi, SQL Server MVP
> > > Archive at:
> >
> http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver> > >
> > >
> > > "Tobias Thernström" <tt@rbam_nospam.se> wrote in message
> > news:eT0gyCFKCHA.1684@tkmsftngp08...
> > > > suser_name() is always NULL for Windows Logins, it is only there for
> > > > backwards compability. Always use suser_Sname().
> > > >
> > > > / Tobias
> > > >
> > > > "Shamim" <shamim.abdul@railamerica.com> wrote in message
> > > > news:#w5729EKCHA.2160@tkmsftngp10...
> > > > > I tried by making the owner of the job as 'sa' and starting the job
> > > > manually
> > > > > and scheduled ...both times suser_name() is NULL.
> > > > >
> > > > > Pls Help
> > > > >
> > > > > Thanks
> > > > > Shamim
> > > > >
> > > > >
> > > > > "Aaron Bertrand [MVP]" <aaronATaspfaq.com> wrote in message
> > > > > news:ufxlOGEKCHA.2592@tkmsftngp08...
> > > > > > Well, first things first... did you try it?
> > > > > >
> > > > > > --
> > > > > > www.aspfaq.com / www.perfhound.com
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Shamim" <shamim.abdul@railamerica.com> wrote in message
> > > > > > news:eVK55$DKCHA.2604@tkmsftngp08...
> > > > > > > HI All,
> > > > > > >      SQL SERVER 7.0
> > > > > > >
> > > > > > > I created a SQL job which executes a stored procedure. Owner of
> > the
> > > > job
> > > > > is
> > > > > > > 'dbadmin',
> > > > > > > If i use SUSER_NAME() inside my stored procedure - what will be
> > the
> > > > > value
> > > > > > > ???
> > > > > > >
> > > > > > > Thanks
> > > > > > > Shamim
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>