MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old January 28th, 2004, 04:12 AM
nadin's Avatar
nadin nadin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK
Posts: 17 nadin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Files to be stored in DB, how?? (MS SQL)

Hi there,
I am working on an application with which I want to upload files (word docs, PDFs etc.) to a MS SQL database from a website form (Browse button etc.).

Unfortunately, I have no clue where to start. Could anyone point me into the right direction please?

What type is the column where the file is stored in and how is the INSERT statement or UPDATE statement in SQL?

Thanks for your help,
N

Reply With Quote
  #2  
Old January 28th, 2004, 05:59 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
Hi,

The type of the column should be "IMAGE" as this simply holds a series of bytes.

You can use INSERT INTO mytable (Col1, MyDocColumn) VALUES (Something, :MyDoc)

Prepare it and bind the parameter.

As for your "browse" button and how to bind parameters, that all depends on your serverside programming language.
__________________
Martijn Tonies
Database Workbench: developer IDE for Firebird, MySQL, InterBase, MSSQL Server and Oracle
Upscene Productions
http://www.upscene.com

Reply With Quote
  #3  
Old January 28th, 2004, 07:29 AM
nadin's Avatar
nadin nadin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK
Posts: 17 nadin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the first pointers


When you said INSERT... (...., :MyDoc), do you actually mean ":example.pdf"?

I tried to find information about this in the official MS SQL Server Books, but with no success...

The "bind" thing you mentioned, has this to be done on DB level?
I am just provided the DB, ie. I have no DBA rights at all.
I can access the tables, ie. INSERT, UPDATE, DELETE. This is as much as I can do...

Thanks for your help.

N

Reply With Quote
  #4  
Old January 28th, 2004, 07:56 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
Hi,

Quote:
When you said INSERT... (...., :MyDoc), do you actually mean ":example.pdf"?

No, what I meant with :MyDoc, is that ":MyDoc" is a parameter.

I come from a Delphi background, we use parameters often in queries. After preparing the query, we can then bind the parameter to the actual data.

In Delphi, this would become:

qry.ParamByName('MyDoc').LoadFromStream(the memory stream that has the document, inside the web-application that receives the web-form)

(pseudocode of course).

What language are you using server side?

Reply With Quote
  #5  
Old January 28th, 2004, 08:11 AM
nadin's Avatar
nadin nadin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK
Posts: 17 nadin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP server side language

Hi there,
thanks for your reply.
I am using PHP. For my websites, I normally use MySQL and I know my way round there, but MSSQL is slightly different.

I have no probs inserting and updating data into MS SQL rows.

So this parameter (makes more sense now), where would I set it? In my web application?
I suppose I have to define it somewhere?
sorry when this sounds amateurish...

Thanks a lot!!!

N

Reply With Quote
  #6  
Old January 28th, 2004, 08:52 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
Yes, in your web app.

But, I don't know how to do this stuff in PHP - you might want to check the manuals for this.

Reply With Quote
  #7  
Old January 28th, 2004, 09:01 AM
nadin's Avatar
nadin nadin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK
Posts: 17 nadin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
cheers. will do that, good old php dot net

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Files to be stored in DB, how?? (MS SQL)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway