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…

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...

PC Build

I recently built myself a PC using the SilverStone SG13 Case. I am planning to use it as a Hot Spare. So any client...