Storing docs with SQL2000

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Storing docs with SQL2000

    :evil;
    hi to all....

    i need help: i'm new to SQL 2000 and i want to create a DB to store my docs
    to put it on my site accessible to every body...

    i have this structures:

    CREATE TABLE . (
    IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
    (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    NOT NULL
    ) ON TEXTIMAGE_ON
    GO

    ALTER TABLE . WITH NOCHECK ADD
    CONSTRAINT PRIMARY KEY CLUSTERED
    (

    ) ON
    GO

    ALTER TABLE . WITH NOCHECK ADD
    CONSTRAINT DEFAULT ('''C\:') FOR ,
    CONSTRAINT DEFAULT ('') FOR ,
    CONSTRAINT DEFAULT (6) FOR
    GO

    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_NULLS ON
    GO


    CREATE PROCEDURE dbo.sp_mt_gen_file_insert

    @CONOP_ID INT,
    @ADJ_REFER VARCHAR(25),
    @ADJ_ID INT,
    @ADJ_NAME VARCHAR(50),
    @ADJ_PATH VARCHAR(100),
    @ADJ_ALIAS VARCHAR(50)


    AS
    INSERT INTO DBO.DOCS
    (DOC_ID,DOC_REFERENCE, DOC_PATH,DOC_NAME, DOC_FILE, DOC_TYPE)
    VALUES
    (@CONOP_ID,@ADJ_REFER,@ADJ_PATH,@ADJ_NAME,@ADJ_ALI AS,@ADJ_ID)


    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO

    and on my page i use <cfstoredproc> to send it ; the problema is that i just
    send the full path to the doc_file column, and i need to send the file( .xls;
    ..doc; .pdf; .jpg; .txt...)

    i was trying with FTP connections, but i think the real problem is on SQL
    structures....


    Any help will be great!..

    GUKLLY Guest

  2. Similar Questions and Discussions

    1. Using Command Behaviour and SQL2000
      I am using the command behaviour in dream weaver mx 2004 to insert data into a table using a stored procedure. It is inserting the data...
    2. sql2000 backwards
      i made the mistake of getting the enterprise evaluation edition that will soon expire. i just purchased the developer edition and am wondering how...
    3. CF, SQL2000, and XML
      Long story short, I need to create an XML file from a SQL table preferably with CF. Right now I'm using a test table just to figure out how to do...
    4. MTB-How to convert multiple .pdf docs to MS Word docs all at same time.
      Is there a way to convert multiple .pdf documents to MS Word Docs all at the same time without having to open each .pdf document & save as a MS Word...
    5. iis/asp + sql2000 a bit slow
      I have a performance problem, but I don't really know where the exact cause lies. Win2k (all patches) / IIS / ASP + VBScript I have a table...
  3. #2

    Default Re: Storing docs with SQL2000

    Hi GUKLLY,

    In the SQL database, your file is just a pile of bits. You have to trick the
    browser into thinking that the pile is an actual file.

    To do this, we use CFCONTENT. An example that would bring back a Word doc
    from your database:
    <CFQUERY name="getdoc" datasource="mysqldatasource">
    SELECT doc_file FROM Docs
    WHERE doc_name = '#whateveryoupasstogetthefile#' --put the correct variable
    reference here
    </CFQUERY>

    <CFCONTENT type="file" filename="#yourfilename#">
    <CFOUTPUT>#getdoc.doc_file#</CFOUTPUT>

    HTH,


    philh Guest

  4. #3

    Default Re: Storing docs with SQL2000

    Well, that was helpful.

    Now that I've REALLY read your post, try using CFFILE action="read" and inserting the variable contents into the table.

    HTH,
    philh Guest

  5. #4

    Default Re: Storing docs with SQL2000

    Hi philh ; i understand, but which data type would be the column on my DB??, cause i put it as TEXT, and as NTEXT, but, it dosn't work...

    GUKLLY Guest

  6. #5

    Default Re: Storing docs with SQL2000

    You would use datatype "varbinary" but take it from experience, it is a HUGE
    mistake to store files this way in SQL server!

    Store them seperately in disk (you can even use a compressed drive) and merely
    store the particulars in SQL server.

    For server storage, rename the file to a globally unique name. In the DB,
    record the storage path and storage name, the original name and file extension,
    plus anything else you want to track about the file.

    MikerRoo Guest

  7. #6

    Default Re: Storing docs with SQL2000

    GUKLLY wrote:
    > Hi philh ; i understand, but which data type would be the column on
    > my DB??, cause i put it as TEXT, and as NTEXT, but, it dosn't work...
    if the data is text, then text, if it contains unicode data use nText.
    if it's "binary" data (word docs, PD, etc.) use image.
    PaulH *TMM* Guest

  8. #7

    Default Re: Storing docs with SQL2000

    MikerRoo wrote:
    > You would use datatype "varbinary" but take it from experience, it is a HUGE
    > mistake to store files this way in SQL server!
    varbinary is probably a bad idea to store a lot of data but storing
    BLOBs in a database isn't anything like a HUGE mistake, at least not
    w/modern databases. that's my experience anyways.
    PaulH *TMM* Guest

  9. #8

    Default Re: Storing docs with SQL2000

    Yeah image is better.
    We don't store such data in the DB because we've learned from experience that
    it's bad. This theorem is backed up by the SMART people that we've read and
    conversed with.

    Anyway, not using these types often, I used the object browser -- which says
    that varbinary has a max length of 2^31-1 bytes.

    This is, of course, wrong and the correct size is stated elsewhere in BOL.

    So, add ANOTHER flaw (documentation/tools) to Microsoft's large-data handling.


    MikerRoo Guest

  10. #9

    Default Re: Storing docs with SQL2000

    MikerRoo wrote:
    > We don't store such data in the DB because we've learned from experience that
    our experience differs. we store huge amounts of binary spatial data in
    databases including raster imagery (aerial/satellite photos, etc).
    besides sql server we also use postGIS (on top of postgreSQL) for this.
    it's nothing for modern db & s/w.
    > it's bad. This theorem is backed up by the SMART people that we've read and
    > conversed with.
    such as who?
    > So, add ANOTHER flaw (documentation/tools) to Microsoft's large-data handling.
    minor.
    PaulH *TMM* 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