Solved

How do I get a path and file name into a MS SQL Server DB field?

Posted on 2007-11-28
4
210 Views
Last Modified: 2008-07-28
I want to add the path and file name of PDF files to a SQL DB record.  The file will be available for viewing when the record is looked up.  I don't need the file itself in the database, just the path to the file and the filename.  I just need some sample scripts on how to get the path and file name and apply that info into the database field called PathFile.  The database name, if it matters, is Donors.

How do I get path and file name into a MS SQL Server DB field?

If you can't tell I am a complete novice at this.  Keep it basic if you can.

Thanks in advance for you assistance.
0
Comment
Question by:lasthope
4 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20370857
It should be the front end code, which need to send the file path to the DB
0
 
LVL 17

Expert Comment

by:pssandhu
ID: 20371040
What are you using? Are you using an application? When and where do you need to pick the file path from? We need some detail background on all the tools that you are working with and need to know where to start from and where to end.

P.
0
 
LVL 18

Accepted Solution

by:
Yveau earned 250 total points
ID: 20372494
Just a varchar() field will do to store it. Make sure it is long enough for the longest path you expect to be in there.
As Aneesh said, you should feed it to the database from the client app. There is a way to look into the filesystem from SQL Server (xp_cmdshell) but that is really not advised due to security risks ! ... and then again if you start looking on the SQL Server filesystem, you should already know the path ... and the .pdf is probably not stored on the SQL Server ...

Hope this helps ...
0
 

Author Comment

by:lasthope
ID: 20377977
Great questions.  Sorry about leaving everyone quessing too much right now.  I'll get some more information and get back to you.

Thanks!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now