Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
USE command with SQL Server Express
Message
 
À
25/09/2007 18:18:48
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01256808
Message ID:
01256855
Vues:
11
>SQL Server Express allows you to "attach" directly to a database file using
>the AttachDBFilename property in the connection builder.
>
>When the file is connected, it can be seen in the Server Management Studio
>like the following:
>
>C:\myfolder\mydatabase.mdf
>
>Here's my challenge. We query multiple databases in the same query. In the
>past this was simple because you'd just add the name of the database in
>front of the table name like follows:
>
>mydatabase.dbo.mytable
>
>and we'd also use the "USE" command to set a database when we were working
>with more than one:
>
>use mydatabase
>select * from mytable
>
>However, I'm not sure now to do this with these Express databases that have
>been attached using the above procedure.
>
>Can anyone please help me on this. I'm getting errors when I try the
>following:
>
>use C:\MYFOLDER\MYDATABASE.MDF
>
>Thanks.
>
>bob bartel

The same:
use mydatabase
select * from mytable
and
select * from mytable.dbo.mytable
If some of these commands raise and error you maybe didn't attach DataBase properly.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform