Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fastest way to synchronize one field
Message
De
05/03/2012 17:05:07
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01537311
Message ID:
01537335
Vues:
21
>To address a table you use Server.Database.Schema.Table, you can use only some of them only, for example if you are going to use a table in the server you are connected to and you already issued a "USE DATABASE" command (or if it is your default database) then you just need to specify Schema.Table in your select statement, furthermore, if the table is in your default schema, you do not need to use it at all so you have the commonly used SELECT * FROM TABLE, without specifying nothing else as SQL understands that you are querying the current server, the current database and the default schema. This leads to multiple combinations, where you can even skip one or more of the names, for example if you want to select from a table that is on the current server, different database, default schema then you can use SELECT * FROM differentDatabase..Table, the double dot is for I am using the my default schema for that database (lets assume it was dbo, so the previous is the same as SELECT * FROM differentDatabase.dbo.Table)
>
>No, in your case I assume you are using a default instance (instead of a named instance) for your server, then the name of the server should be enough (this I am not sure as I avoid using default instances, I always name my server instances) otherwise I think you could use [Server\Server], let me put this in an example
>
>I have a computer named myComputer and I have two instances of SQL server installed mySQL1 and mySQL2 so, if you want to extract data from the first instance you use [myComputer\mySQL1] as the server, if you want the data from the second instance then you use [myComputer\mySQL2], now if you want the data from the default instance, here I am guessing a bit, you can either use just [myComputer] or [myComputer\myComputer] (but I am sure that you should use the same as what appears in your linked servers item, which you blacked out) as name of the server.
>
>One last thing, you are using JOIN MyOtherServer.MyDatabase.Client, which is missing the schema, so you should either use JOIN MyOtherServer.MyDatabase..Client (double dot, meaning default schema) or JOIN MyOtherServer.MyDatabase.mySchema.Client
>
>
>
> so in your case

Thanks, I added a second dot. So, I was able to obtain something more. I checked for the instance and this is not defined. I can see it in the property of the server. So, I tried:
UPDATE Client
 SET Address=o.Address FROM Client m
 JOIN MyOtherServer..MyDatabase.Client o on o.Numero=m.Numero
...and now I get:

The OLE DB provider "SQLNCLI10" for linked server "MyOtherServer" does not contain the table ""MyDatabase"."Client"". The table either does not exist or the current user does not have permissions on that table.

However, the table does exist as the linked server shows it under.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform