Here's what ya need to do:

1) Give a direct path to your file
        
        D:\Program Files\Microsoft SQL Server\80\Tools\Binn\cust.sql

2) Wrap your infile with quotes:

        "D:\Program Files\Microsoft SQL Server\80\Tools\Binn\cust.sql"

3) Be sure to specify what database you are querying in "cust.sql":

        SELECT * FROM DATABASE..TABLENAME

OSQL defaults to the local server, however it can be used to make remote
server calls (run OSQL with '?' and it will list the available args).
So if you wanted to, you could pass the server and database, or just the
ODBC DSN as args in the command line.

END RESULT:

<cfexecute
         name="D:\Program Files\Microsoft SQL
Server\80\Tools\Binn\osql.exe"
         arguments="-Usa -Pwindows95 -i "" D:\Program Files\Microsoft
SQL Server\80\Tools\Binn\cust.sql"""
         timeout="10" />

NOTE that I am using double quotes inline to escape them and pass it to
the command line.

You can also pass a straight query to OSQL:

C:>osql -Usa -P -Q "SELECT * FROM DATABASE..TABLENAME"

Hope this helps!



-----Original Message-----
From: Kola Oyedeji [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 23, 2002 3:08 AM
To: CF-Talk
Subject: Using cfexecute to call SQL server fron the command line

Hi

I am trying to use cfexecute to call SQL server from the command line.

The following command works on the command line it executes the query
script
and
displays the results of the query however when i call it using cfexecute
it
returns a list of parameters as if the parameters being sent are wrong.
I'm
wondering if cf is changing the case of the parameters as the parameters
are
case sensitive. Is there anyway to see what was passed to cfexecute?

<cfexecute
         name="D:\Program Files\Microsoft SQL
Server\80\Tools\Binn\osql.exe"
         arguments="-Usa -Pwindows95 -i cust.sql"
         timeout="10" />


contents of cust.sql :

select * from customers

i placed cust.sql in the same directory as osql and the template so i
dont
think thats the problems

thanks

kola



______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to