Re: Cannot get OSQL line to work for SharePoint

Tech-Archive recommends: Fix windows errors by optimizing your registry



Tony Girgenti wrote:

Hello Steve.

I'm sure other people have moved their SharePoint files from one drive to
another in SBS2003 Premium.

I expect you're right.

How did they accomplish it ? Did they use these instructions or some other
procedure ?

That's all i want to do. If other people have done it, how did they do it ?

I assume these are rhetorical questions, since there's no way to sensibly answer them.

I'm not entirely sure how this post relates to your original question, and my response thereto. You might want to go back and take another look at the thread.

And do you need the OSQL command to execute automatically and quit? Because you can use it as an interactive query tool too, which might be easier for you to work with.

eg (in a CMD window):

C:\> OSQL -S (local)\Sharepoint -E

should start a query session and connect to the sharepoint instance on the local machine (ie you'd have to run OSQL on the server itself). The prompt should change to "1>".

You could then enter the sp_attach_db command directly (no need for the quotation marks necessary to submit the query via the -q or -Q switch):

1> sp_attach_db 'STS_Config','<path to MDF>','<path to LDF>'

then you enter a "go" statement to submit the query to SQL Server (you need this because OSQL "batches" SQL statements):

2> go

OSQL would then output the results of executing the batch.

You can keep on writing SQL statements and submitting them to SQL ad infinitum, or until you've had enough, and to quit OSQL, use either of these:

1> exit

or

1> quit

both of which will end OSQL and return you to the CMD prompt.

--
Steve Foster [SBS MVP]
---------------------------------------
MVPs do not work for Microsoft. Please reply only to the newsgroups.
.



Relevant Pages

  • Re: Clarification of BytesSent vs BytesSentDelta in ISA 2004 Firewall log
    ... I then tried OSQL, to try get the same information as the 'Traffic by Date' ... The Query I used was as follows: ... > Log Record Type Equals Firewall or Web Proxy Filter ... I created a daily report for March 12 and I ...
    (microsoft.public.isaserver)
  • Re: osql in a cmd file, with SQL statements coming from the same cmd f
    ... Instead of having the SQL ... > want to have the SQL statements right there in the command file. ... > about instead of separate cmd and sql files. ... > Any way to do this with OSQL, ...
    (microsoft.public.sqlserver.tools)
  • Re: long SQL lines for osql
    ... It works great in Query ... Analyzer, but when run through osql it takes errors on lines that are ... One thing to keep in mind, is by default OSQL runs with QUOTED_IDENTIFIER ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: Can you use osql in DTS?
    ... Don't know if I mentioned it, but I am on SQL 7. ... > DTS can use Dynamic Properties tasks. ... > Can the osql be used in DTS? ... > @chartime into a stored procedure that I would call. ...
    (microsoft.public.sqlserver.dts)
  • Re: Can you use osql in DTS?
    ... Don't know if I mentioned it, but I am on SQL 7. ... > DTS can use Dynamic Properties tasks. ... > Can the osql be used in DTS? ... > @chartime into a stored procedure that I would call. ...
    (microsoft.public.sqlserver.programming)