Attaching files to row information in SQL server

10 pts.
Tags:
SQL Server administration
I'm a new babie in the use of SQL server. Infact i've never used it though i use SQL and Mysql but just as a beginner. Now i find myself in a company where I have to create a database for 180,000 records. whereas, each of these records have 5 documents to be attached against it. Please how can i go about this?

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you are talking about database administration where you are tasked to provide the database, you just need to create the database and provide user accounts for access to the database. You should discuss user access and table naming with your developers.

If you are tasked to develop an application for a database, you just need to program the SQL data connectors. Programming this depends on the programming language you will be using.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    I think that what Phunmie is asking is how to attach documents to database records (i.e. store documents in database fields). One way could be to store the documents in the file system, and store the document's path in a varchar field in the database.
    69,175 pointsBadges:
    report
  • Kccrosser
    Personally, I would store the documents as BLOBs in the database, using a structure similar to the following:
    table MyMainTable (
        MyMainRecordKey    <whatever the primary key is for your 180000 record table>
        MyOtherData ...
    );
    
    table MyDocuments (
        MyMainRecordKey    <the foreign key to link to the main table(s)>
        MyDocumentKey     <a unique record id for each individual document>
        DocumentName    varchar
        DocumentTitle   varchar
        DocumentType   varchar   <business document type - e.g., deed, contract, etc.>
        DocumentDate   datetime
        other document structured information as appropriate
    );
    
    table MyDocumentImage (
         MyDocumentKey   <primary key for each unique document>
         DocumentImageData    varbinary(max)
         DocumentDataType    <xml, jpeg, mpeg, tiff, etc.>
    );
    
    With this kind of structure, you can have as many documents associated to your main set of data as needed (0..n), the business attributes related to the individual documents can be captured in the MyDocuments table, and the actual BLOB data is captured in a separate table. This structure also makes it easy to decide to store the physical document files in a separate file system - just keep the storage information (host, directory path, file name) in a table and use it to retrieve/store the file data. If you are asking how to actually store/retrieve BLOB data, there are many online references that discuss this in detail, including the online SQL Server Language references.
    3,830 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following