You are here: Re: connecting in a script to another db « MsSQL Server « IT news, forums, messages
Re: connecting in a script to another db

Posted by Jeff Kish on 03/23/06 23:40

On 23 Mar 2006 13:16:41 -0800, "sdyckes" <stephendyckes@gmail.com> wrote:

>Jeff,
>
> You can specify the from clause of SQL statements as
>DATABASE.OWNER.TABLE, as long as they are on the same SQL Server. You
>may also utilize the USE DATABASE command to change which database you
>script will execute in. But, if you have different servers you want to
>access, then that will not work unless you have set up Linked Servers.
>In which case you would add the servername to the beginning of your
>sting: SERVERNAME.DATABASE.OWNER.TABLE.
>
>Update Table1 set C1 = 'YES' from Table1 T1, Table2 T2 where
>T1.ReportID = T2ReportID
>
>use DB2 --This Example will use both Databases to update the column
>
>Update Table 4 set C5 = 'Report Printed' from Table4 T4, DB1.DBO.Table1
>T1 where T4.ReportID = T1.ReportID
>
>Steve
Thanks Steve. They will be on the same SQL Server, so I can run with this.

Regards
Jeff Kish

 

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

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