3

a friend of mine complained that SQL managment studio express is prohibited by some security setting set by his system admin. i recommended to use OSQL

alt text

my question is

i need some basic orders like best way to attach, detach and deal with SQL express databases. any ideas?

Community
  • 1
  • 1
Mohamed Kamal
  • 2,377
  • 5
  • 32
  • 47

2 Answers2

6

MSDN is always the best source.

osql on MSDN (with examples).

However, microsoft will remove this utility in future versions, so you should start using sqlcmd instead.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • 1
    Thanks Oded, these links are also useful http://msdn.microsoft.com/en-us/library/ms170207.aspx and http://msdn.microsoft.com/en-us/library/ms166559.aspx and http://msdn.microsoft.com/en-us/library/ms170572.aspx – Mohamed Kamal Dec 17 '10 at 16:34
1

If you are familiar with normal query syntax, it may be easier for you to write queries to .SQL files (edit in notepad and change the extension), then call from osql with either < filename.sql or -i filename.sql. Then you also only have to write out the commands once and can reuse them.

JNK
  • 63,321
  • 15
  • 122
  • 138
  • can you clarify with one example i am still beginner but i know SQL insert, delete , select and update – Mohamed Kamal Dec 17 '10 at 16:20
  • 1
    @mokokamello - I guess what I am saying is, **it is easier to do longer procedures with multiple lines** (insert, then a delete, then an update, or whatever) **if you can write it all out in a text file instead of line by line in osql** – JNK Dec 17 '10 at 16:24