Databases in MSDE

Written by James McDonald

November 3, 2008

Login using osql
Windows Auth
osql -E
SQL Auth
osql -U sa

List databases
1>sp_databases
2>go

To list the tables in a database

1>use dbname
2>go
1>sp_tables
2>go

To show the table structure
1>use dbname
2>go
1>sp_help table_name
2>go

Attach a DB
exec sp_attach_db @dbname = ‘test3’,
@filename1 = ‘C:\data\master.mdf’,
@filename2 = ‘c:\data\mastlog.ldf’
go

Detach a DB
EXEC sp_detach_db ‘mydb’
go

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...