Thursday, March 29, 2012

export from mssql database

Hello,

I try to export a mssql database into a csv-file.

I tried this with asp, but it doesn't work.

<%
Dim objConn
Dim csv_path

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "database","username","passwd"

csv_path =Server.MapPath("./") & "\csv_test.csv"
SQL ="SELECT * INTO OUTFILE 'C:\inetpub\wwwroot\csv_test.csv' FIELDS
TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"' FROM GROUPS"
objConn.Execute SQL
objConn.Close
Set objConn = Nothing
%
There is a problem near 'C:\inetpub\wwwroot\csv_test.csv'
Can anyone help? Thank you.

Manuel"Manuel" <manuelitoh@.web.de> wrote in message
news:4a77b755.0410130720.9128112@.posting.google.co m...
> Hello,
> I try to export a mssql database into a csv-file.
> I tried this with asp, but it doesn't work.
> <%
> Dim objConn
> Dim csv_path
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.open "database","username","passwd"
>
> csv_path =Server.MapPath("./") & "\csv_test.csv"
> SQL ="SELECT * INTO OUTFILE 'C:\inetpub\wwwroot\csv_test.csv' FIELDS
> TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"' FROM GROUPS"
> objConn.Execute SQL
> objConn.Close
> Set objConn = Nothing
> %>
> There is a problem near 'C:\inetpub\wwwroot\csv_test.csv'
> Can anyone help? Thank you.
> Manuel

You seem to be using MySQL syntax, not MSSQL (Microsoft SQL Server), so I
guess you'll get a better answer in a MySQL forum. If you are using MSSQL,
then I suggest you check out osql.exe, bcp.exe, or DTS.

Simon

No comments:

Post a Comment