Exporting tables via ODBC from SQL SERVER

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Exporting tables via ODBC from SQL SERVER

    I need to provide a way for a client to pull information
    from SQL Server to Word, Excel, etc. via a web browser
    using Active Server Pages.
    I was going to just write a little utility that output CSV
    files to the browser based on the query, but thought I
    would see if there was a "better" way.

    I see some examples of doing something like:
    SELECT * INTO
    [Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;].
    [OutFile#txt] FROM TestTable
    However when I do this I get an error like

    [Microsoft][ODBC SQL Server Driver][SQL Server]Specified
    owner name 'Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;'
    either does not exist or you do not have permission to use
    it.

    I've tried all the variations I have found and can think
    of. Is this something you just can't do from ASP? Or am I
    just missing something obvious?

    Appreciate any insights or examples.

    Mark

    Mark Guest

  2. Similar Questions and Discussions

    1. ODBC\JDBC on same server
      We are building a new Windows server. One of the ColdFusion (MX 7) Admins created a slew of DSNs but when I looked for them I couldn't find a...
    2. [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
      Hi, I am able to retrieve data from database and then the object name is fine, say SELECT * FROM problemdb, but when I try to use INSERT, I get...
    3. Undefined tables after exporting slices in MX 2004
      Why is it that I get undefined borders, cell spacing, cell padding, etc. when I export slices to Dreamweaver? Isn't there a default setting to change?
    4. Exporting Different Tables to Same Flat File
      If you cannot find a why to do it, consider making two files and then use DOS XCOPY (or whatever) to combine them into one. Bye, Delbert Glass...
    5. 8.1.7.4.0 Server & 8.05 ODBC
      We've recently upgraded from an 8.05 server to 8.1.7.4.0. I'm still using the ODBC driver for 8.05 but have been experiencing problems, so I've...
  3. #2

    Default Re: Exporting tables via ODBC from SQL SERVER

    > I see some examples of doing something like:
    > SELECT * INTO
    > [Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;].
    > [OutFile#txt] FROM TestTable
    Not from SQL Server, I don't think.

    [url]http://www.aspfaq.com/2482[/url]

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: Exporting tables via ODBC from SQL SERVER

    This syntax is for Jet, not SQL Server.

    --

    "Mark" <mark@sloanadams.com> wrote in message news:<532a01c3d966$3ea1f980$7d02280a@phx.gbl>...
    > I need to provide a way for a client to pull information
    > from SQL Server to Word, Excel, etc. via a web browser
    > using Active Server Pages.
    > I was going to just write a little utility that output CSV
    > files to the browser based on the query, but thought I
    > would see if there was a "better" way.
    >
    > I see some examples of doing something like:
    > SELECT * INTO
    > [Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;].
    > [OutFile#txt] FROM TestTable
    > However when I do this I get an error like
    >
    > [Microsoft][ODBC SQL Server Driver][SQL Server]Specified
    > owner name 'Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;'
    > either does not exist or you do not have permission to use
    > it.
    >
    > I've tried all the variations I have found and can think
    > of. Is this something you just can't do from ASP? Or am I
    > just missing something obvious?
    >
    > Appreciate any insights or examples.
    >
    > Mark
    onedaywhen Guest

  5. #4

    Default Re: Exporting tables via ODBC from SQL SERVER

    I realize that what I am writing into is Jet, but my
    connection is to SQL server. So, does that mean that I
    cannot do this at all or is there some way around it?

    Mark
    >-----Original Message-----
    >This syntax is for Jet, not SQL Server.
    >
    >--
    >
    >"Mark" <mark@sloanadams.com> wrote in message
    news:<532a01c3d966$3ea1f980$7d02280a@phx.gbl>...
    >> I need to provide a way for a client to pull
    information
    >> from SQL Server to Word, Excel, etc. via a web browser
    >> using Active Server Pages.
    >> I was going to just write a little utility that output
    CSV
    >> files to the browser based on the query, but thought I
    >> would see if there was a "better" way.
    >>
    >> I see some examples of doing something like:
    >> SELECT * INTO
    >> [Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;].
    >> [OutFile#txt] FROM TestTable
    >> However when I do this I get an error like
    >>
    >> [Microsoft][ODBC SQL Server Driver][SQL Server]
    Specified
    >> owner
    name 'Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;'
    >> either does not exist or you do not have permission to
    use
    >> it.
    >>
    >> I've tried all the variations I have found and can
    think
    >> of. Is this something you just can't do from ASP? Or am
    I
    >> just missing something obvious?
    >>
    >> Appreciate any insights or examples.
    >>
    >> Mark
    >.
    >
    Guest

  6. #5

    Default Re: Exporting tables via ODBC from SQL SERVER

    *Must* your connection be to SQL Server? Could you instead connect to
    a Jet source i.e. using the Jet OLEDB provider? It needn't be an .mdb
    file (MS Access), it could be an existing, but totally arbitrary,
    Excel workbook (but it can't be the text file folder, it seems). For
    example, assuming ADO, your connection string would be something like:

    Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=C:\Temp\MyWorkbook.xls;Extended Properties='Excel 8.0'

    You could then specify the connection to both the text file folder
    *and* SQL Server in the query e.g.

    SELECT MyCol1, MyCol2
    INTO [Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP\;].[OutFile#txt]
    FROM [ODBC;Driver={SQL
    Server};SERVER=MyServer;DATABASE=MyDB;UID=;Pwd=;].MyTable

    Note that you can use a SELECT..INTO query to create a new
    workbook/worksheet, rather than a text file e.g.

    SELECT MyCol1, MyCol2
    INTO [Excel 8.0;database=C:\TEMP\NewWorkbook.xls;].Sheet1
    FROM [ODBC;Driver={SQL
    Server};SERVER=MyServer;DATABASE=MyDB;UID=;Pwd=;].MyTable

    If you *must* be connected SQL Server, you will have to use SQL Server
    methods e.g. take a look at OPENROWSET.

    --

    <anonymous@discussions.microsoft.com> wrote in message news:<0c8501c3d9f8$28b986f0$a501280a@phx.gbl>...
    > I realize that what I am writing into is Jet, but my
    > connection is to SQL server. So, does that mean that I
    > cannot do this at all or is there some way around it?
    >
    > Mark
    > >-----Original Message-----
    > >This syntax is for Jet, not SQL Server.
    > >
    > >--
    > >
    > >"Mark" <mark@sloanadams.com> wrote in message
    > news:<532a01c3d966$3ea1f980$7d02280a@phx.gbl>...
    > >> I need to provide a way for a client to pull
    > information
    > >> from SQL Server to Word, Excel, etc. via a web browser
    > >> using Active Server Pages.
    > >> I was going to just write a little utility that output
    > CSV
    > >> files to the browser based on the query, but thought I
    > >> would see if there was a "better" way.
    > >>
    > >> I see some examples of doing something like:
    > >> SELECT * INTO
    > >> [Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;].
    > >> [OutFile#txt] FROM TestTable
    > >> However when I do this I get an error like
    > >>
    > >> [Microsoft][ODBC SQL Server Driver][SQL Server]
    > Specified
    > >> owner
    > name 'Text;FMT=Delimited;HDR=Yes;DATABASE=C:\TEMP;'
    > >> either does not exist or you do not have permission to
    > use
    > >> it.
    > >>
    > >> I've tried all the variations I have found and can
    > think
    > >> of. Is this something you just can't do from ASP? Or am
    > I
    > >> just missing something obvious?
    > >>
    > >> Appreciate any insights or examples.
    > >>
    > >> Mark
    > >.
    > >
    onedaywhen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139