Showing posts with label connected. Show all posts
Showing posts with label connected. Show all posts

Sunday, March 11, 2012

Change connected user to avoid owner prefix in queries

Hi everybody,

I've five instances of SQL Server 2000 with the SAME database with a
DIFFERENT owner in each server. I, as the administrator, have a lot of
queries that I have to execute in some or all servers. The problem is
that I have to connect to all servers with MY user, not each of the db
owners...

So I have queries this way:

select * from mike.table1 t1 join mike.table2 t2 on...

And when I connect to another server I have to change mike for jeremy
in all the SQLs...

And when I connect to another server I have to change jeremy for nina
in all the SQLs...

I know that there was an old, v7, deprecated way to change the
"schema", something like

change current user to kimberly
go
select * from table1 t1 join table2 t2 on...

This way, I'll change ONLY once the connected user. I could even do at
the beginning of the script an IF, to change the connected user
depending on @.@.SERVERNAME !!!

Can someone remember this instruction?

Thanks in advance for your help !!!Found it !!!

setuser 'q01'

-- quien importo una orden de transporte
select USERNAME, SYDATE, SYTIME, CLIENT
from TPLOG
where CMDSTRING like '%D02K909789%

Quote:

Originally Posted by

>From BOL:


SETUSER
Allows a member of the sysadmin fixed server role or db_owner fixed
database role to impersonate another user.

Important SETUSER is included in Microsoft? SQL Server? 2000 only for
backward compatibility, and its usage is not recommended. SETUSER may
not be supported in a future release of SQL Server.

Syntax
SETUSER [ 'username' [ WITH NORESET ] ]

Arguments
'username'

Is the name of a SQL Server or Microsoft Windows NT? user in the
current database that is impersonated. When username is not specified,
the original identity of the system administrator or database owner
impersonating the user is reestablished.

WITH NORESET

Specifies that subsequent SETUSER statements (with no specified
username) do not reset to the system administrator or database owner.

Tuesday, February 14, 2012

Catastrophic Failure

I have a site that has had 70+ pc with msaccess frot end connected to sql200
0
server back end. This site has been in production for 12 months.
With in the last week we have experienced an increasing frequency of
-2147418113 Catastrophic Failure errors. The application writes data from a
tempory in access table back to a table in SQL server. The error doesnot
occur
I have run trace on the server and no sql errors are shown.
The registry on a few machines i have checked have data access version of
2.81.1117.0 the rollback version is 2.70.9001.0.
If i change the ado version in access to 2.5 or 2.1 from 2.8 the frequency
of the error diminishes. Also the adox version shows as 2.7 whenin the list
of available references after selection when re checked it chows as adox 2.8
.
Any ideas would be appreciated.
Craig BJust a thought, but have noted this error in the past when using MS
DTC, e.g. if the DTC service is stopped or crashes, or if a COM+
package is "Shut Down" while active transactions in the package are
running.|||Thanks,
I checked the things you mentioned, nothing obvious shows in services or the
event log.
I have been doing some more cheking and on sql side a trace showns no
errors.
One thing i have found is if say 6 records are writen back then things are
ok, when only 2 or less then the error occurs.
I am currently running an odbc log.
I have looked at kb q243349, but that problem was fixed in mdac 2.5
CraigB
"NonNB" wrote:

> Just a thought, but have noted this error in the past when using MS
> DTC, e.g. if the DTC service is stopped or crashes, or if a COM+
> package is "Shut Down" while active transactions in the package are
> running.
>|||i have will have my client check for client machines to see if dtc or com+
errors. on futher checking on my machine i found dtc had stoped the log was
missing. but every thing worked ok except for what appear to be random event
s
when low records rows are returned. Given the writeback code has been in
production for a year i am perplexed.
Thanks for youe input, something has changed or caused the issues.
CB
"NonNB" wrote:

> Just a thought, but have noted this error in the past when using MS
> DTC, e.g. if the DTC service is stopped or crashes, or if a COM+
> package is "Shut Down" while active transactions in the package are
> running.
>