Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 MSDE (2000)
 OSQL question

Author  Topic 

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-04-17 : 02:13:12
hi,
I am trying to connect to MSDE through osql utility.
After authenticating the uname and password it just gives me the promt with numbers like
1>
2>
3>
etc..
after typing any query the statement does not terminate on pressing enter a new line with new number comes up.
can anyone advice me what is going on?
regards,
Harshal.

Expect the UnExpected

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-04-17 : 03:09:20
Hi Harshal!

If you use osql like a tool like that, you will have to use the GO keyword for the statements to execute.

Look up "osql utility" in BOL for more info.



Go to Top of Page

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-04-19 : 08:58:29
quote:

Hi Harshal!

If you use osql like a tool like that, you will have to use the GO keyword for the statements to execute.

Look up "osql utility" in BOL for more info.









THANKS A LOT
I had tried many different things ;)
regards,
Harshal.

Expect the UnExpected
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-04-19 : 09:14:13
If you create a directory c:\osql
create a file runosql.bat (don't call it osql.bat - try it and find why)
in it place the osql command

osql -E -S(local) -i%1 -oout%1 -w1000

create the osql command file with the commands
osql1.txt
select * from sysobjects
go
select top 10 name from syscolumns
go

now in the command window set to the directory c:\osql and type

runosql osql1.txt

it will run the file and create an output file outosql1.txt with the results.

You now have a record of what you have done and the results and can easily run them again at any time.


Ofterthought
You can probably name the command files .osl, set runosql.bat to be the default app for .osql and run them by double clicking.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.

Edited by - nr on 04/19/2003 09:17:41
Go to Top of Page

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-04-19 : 10:51:44
quote:

If you create a directory c:\osql
create a file runosql.bat (don't call it osql.bat - try it and find why)
in it place the osql command

osql -E -S(local) -i%1 -oout%1 -w1000

create the osql command file with the commands
osql1.txt
select * from sysobjects
go
select top 10 name from syscolumns
go

now in the command window set to the directory c:\osql and type

runosql osql1.txt

it will run the file and create an output file outosql1.txt with the results.

You now have a record of what you have done and the results and can easily run them again at any time.


Ofterthought
You can probably name the command files .osl, set runosql.bat to be the default app for .osql and run them by double clicking.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.

Edited by - nr on 04/19/2003 09:17:41



That was great Help nr .the other things u suggested I will surely try latter .
thnxs
harshal

Expect the UnExpected
Go to Top of Page
   

- Advertisement -