You are here: Change connected user to avoid owner prefix in queries « MsSQL Server « IT news, forums, messages
Change connected user to avoid owner prefix in queries

Posted by MADS on 03/16/07 13:45

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 !!!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация