Showing posts with label sending. Show all posts
Showing posts with label sending. Show all posts

Friday, March 30, 2012

Invoking or sending SQL queries using dOS

Hello Folks,
I want to create a simple batch DOS script to query mi SQL Server 2000 database. How I could do this?
I just want to run a select for a table but I dont want people to interct with sql query analyzer or enterprise manager to avoid any issues.
Regards,Look up OSQL or ISQL in Books Online.

Basically:
OSQL -S <name of your server/instance> -U <UID> -P <PWD> -d <Database to use> -Q"<your select statment>" -n -b

I do this all the time so post back if you have more questions.|||Originally posted by Paul Young
Look up OSQL or ISQL in Books Online.

Basically:
OSQL -S <name of your server/instance> -U <UID> -P <PWD> -d <Database to use> -Q"<your select statment>" -n -b

I do this all the time so post back if you have more questions.

UID stands for? PWD I assume is the pasword, isnt.

How I can redirect the results to a txt file,

OSQL -S OSQL -S <name of your server/instance> -U <UID> -P <PWD> -d <Database to use> -Q"<your select statment>" -n -b >> query.txt

Am I right?

Thanks for your prompt reply and help|||UID = User ID

You could pipe the output to a text file but the -o parm would be more usefull.|||How I can get the instance name. I have tested in my environment and I got the next error:

[DBNETLIB] Sql Server does not exist or access denied
[DBNETLIB] ConnectionOpen <Connect(())

As per this result I checked the server name I used typing osql -L. I got the names and used them but with the same result.

When I open the Sql query analyzer I connect using windows authentication option to connect to my databases.

Please suggest..|||For Windows Security I think you need to use -E option instead of -U and -P options.

Tim Ssql

Wednesday, March 28, 2012

Invalid Target name - how can it be determined?

Hi, I am sending a message to an invalid target name. The message eventually gets back to the initiator as an error type message. How can I determine the exact cause of the error - and determine that the target service name is invalid? I am using the ServiceBrokerInterface and the Message does not tell much - it seems. Also, in the sys.conversation_endpoints table, the record associated to the message only says 'Error', but no other indicator.

I found it - it is embedded as a stream in the Body property.|||

Right, the cast the response Error message_body to XML and the text will contain the problem service name.

HTH,
~ Remus

Wednesday, March 7, 2012

Intra-query parallelism ???

Hi,
Im using SQL 7.0 with FrontPage sending code to the dB.
Im getting the following error and dont understand what it means.
------
Database Results Error
Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Intra-query parallelism caused your server command (process ID #13) to deadlock. Rerun the query without intra-query parallelism by using the query hint option (maxdop 1).
Number: -2147217900 (0x80040E14)
Source: Microsoft OLE DB Provider for ODBC Drivers
-----
The code is long and has several sub-queries.
All are looking to the same rows in the dB.
Im passing a parameter from FP. If I remove the parameter and hardcode the value I dont get this error.
Is this problem SQL or FP? If SQL what am I looking at?

Thanks for you help

MottyThis does happen if you're on a multi-processor server. The query is being splitted up for parallel processing. Unfortunately, they happen to block each other.

As the error suggests, you either rerun or use option hint (maxdop 1) to limit the processing to one processor.