Showing posts with label osqlexe. Show all posts
Showing posts with label osqlexe. Show all posts

Monday, March 12, 2012

OSQL.exe question

Is there a way to process multiple SQL scripts in a single transaction using
osql.exe ?
Ideally, I'd like to be able to start transaction, execute multiple sql
scripts and commit transaction when all of them succeeded or rollback when
there was a failure.
I appreciate your help.
I would copy and paste them together.
-jens S=FC=DFmeyer.
|||"Marek" <nospam@.nowhere.com> wrote in
news:#BmMdSD8FHA.2676@.TK2MSFTNGP15.phx.gbl:

> Is there a way to process multiple SQL scripts in a single transaction
> using osql.exe ?
> Ideally, I'd like to be able to start transaction, execute multiple
> sql scripts and commit transaction when all of them succeeded or
> rollback when there was a failure.
> I appreciate your help.
As far as I know this is not possible in osql, but if you try sqlcmd from
SQL Server 2005, I do believe that you can. However, I have not tried this.
SqlCmd is also available in SQL Server 2005 Express, which is free.
Ole Kristian Bangs
MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging
|||"Ole Kristian Bangs" <olekristian.bangas@.masterminds.no> wrote in
news:Xns9717A547BD7D7olekristianbangaas@.207.46.248 .16:

> "Marek" <nospam@.nowhere.com> wrote in
> news:#BmMdSD8FHA.2676@.TK2MSFTNGP15.phx.gbl:
>
> As far as I know this is not possible in osql, but if you try sqlcmd
> from SQL Server 2005, I do believe that you can. However, I have not
> tried this. SqlCmd is also available in SQL Server 2005 Express, which
> is free.
And as Tibor so kindly answered in another group: You can download SqlCmd
here:
http://www.microsoft.com/downloads/d...D09C1D60-A13C-
4479-9B91-9E8B9D835CDC&displaylang=en
Ole Kristian Bangs
MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging
|||> As far as I know this is not possible in osql
I guess you could try the :r option to have OSQL read sub-scripts from a mother script. The
sub-scripts cannot have GO. A test is needed to verify that new connections will not be opened for
subscripts, use Profiler for that. Also, :r is not documented for OSQL, but I think it is for
SQLCMD. However, I don't think that error handling will be the easiest thing to accomplish.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ole Kristian Bangs" <olekristian.bangas@.masterminds.no> wrote in message
news:Xns9717A547BD7D7olekristianbangaas@.207.46.248 .16...
> "Marek" <nospam@.nowhere.com> wrote in
> news:#BmMdSD8FHA.2676@.TK2MSFTNGP15.phx.gbl:
>
> As far as I know this is not possible in osql, but if you try sqlcmd from
> SQL Server 2005, I do believe that you can. However, I have not tried this.
> SqlCmd is also available in SQL Server 2005 Express, which is free.
> --
> Ole Kristian Bangs
> MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging

osql.exe

Is there some registry key that tell me if and where osql.exe is lcoated?
--
Sincerely
Andrea Morohi Andrea,
"Andrea Moro" <moroandreaET@.tiscalinet.it> ha scritto nel messaggio
news:%23JY7YyJcDHA.616@.TK2MSFTNGP11.phx.gbl...
> Is there some registry key that tell me if and where osql.exe is lcoated?
have a look at HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\80\
SharedCode key which should point to
c:\program files\Microsor SQL Server\80\Tools\
or HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\80\Tools\ClientSetup
SQLPAth key which should point to
c:\program files\Microsor SQL Server\80\Tools\
just consider oSql.exe resides in the Binn subfoler...
hth
Andrea Montanari
andrea.sql@.virgilio.it
montanari_andrea@.virgilio.it
http://www.asql.biz/DbaMgr.shtm
DbaMgr2k ver 0.4.0 - DbaMgr ver 0.50.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply|||Refer to this url
http://www.vb2themax.com/Item.asp?PageID=CodeBank&ID=688
--
-Vishal
"Andrea Moro" <moroandreaET@.tiscalinet.it> wrote in message
news:#JY7YyJcDHA.616@.TK2MSFTNGP11.phx.gbl...
> Is there some registry key that tell me if and where osql.exe is lcoated?
> --
> Sincerely
> Andrea Moro
>|||with t-sql you can have something like this:
create table #test (value varchar(500), data varchar(500))
nsert into #test
exec master..xp_regread N'HKEY_LOCAL_MACHINE',N'SOFTWARE\Microsoft\Microsoft
SQL Server\80\Tools\ClientSetup', N'SQLPath'
select data + '\bin' as 'osql_path' from #test
--
-Vishal
"Vishal Parkar" <vgparkar@.hotmail.com> wrote in message
news:e0ysoXKcDHA.2688@.TK2MSFTNGP11.phx.gbl...
> Refer to this url
> http://www.vb2themax.com/Item.asp?PageID=CodeBank&ID=688
> --
> -Vishal
> "Andrea Moro" <moroandreaET@.tiscalinet.it> wrote in message
> news:#JY7YyJcDHA.616@.TK2MSFTNGP11.phx.gbl...
> > Is there some registry key that tell me if and where osql.exe is
lcoated?
> >
> > --
> > Sincerely
> > Andrea Moro
> >
> >
>

osql.exe

Hi,
I am using the osql utility from two different machines,
both in the same workgroup and on the same network
segment. When running osql -L, workstation1 reports two
available servers, while workstation2 reports 6 available
servers. Where does the osql utility pull server
information from when the -L switch is used?
ActiveDirectory?
Local machine registry?
broadcast?
Thanks,
JohnNetwork broadcast.
OSQL -L uses the ODBC SQLBrowseConnect functionality. It's
not guaranteed to give a complete list due to broadcast
issues, network routers/subnet issues, instances may not
respond within the timeout period, etc. You can find issues
listed here:
http://www.sqldev.net/misc/ListSQLSvr.htm
-Sue
On Wed, 10 Mar 2004 11:06:07 -0800, "John"
<anonymous@.discussions.microsoft.com> wrote:

>Hi,
>I am using the osql utility from two different machines,
>both in the same workgroup and on the same network
>segment. When running osql -L, workstation1 reports two
>available servers, while workstation2 reports 6 available
>servers. Where does the osql utility pull server
>information from when the -L switch is used?
>ActiveDirectory?
>Local machine registry?
>broadcast?
>Thanks,
>John
>