Ask a Question related to Coldfusion Database Access, Design and Development.
-
HugoSchmidt #1
INSERT file to column
I have done some due diligence looking for an answer, but I have not found it
so here is my post:
I have a table t_CustomerFiles, with two columns, CustomerID (INT) and
FileData (NTEXT)
On a web page the customer is uploading a file and I want to insert the entire
file (it is TEXT, not binary) into the table. The following does not work 100%
of the time. Sometimes the preservesinglequote fails and the INSERT statement
gets terminated.
<cffile action="READ" file="D:\customerFile.txt" variable="ReadFile">
<cfquery datasource="#CurDS#" dbtype="#CurDSType#">
INSERT INTO CustomerFiles (CustomerID , FileData )
VALUES(12342, '#preservesinglequotes(ReadFile)#')
</cfquery>
Is there a way that I can simply tell Microsoft SQL Server 2000 to "go get
that file and put it in the database with the CustomerID?"
Somethig like this:
<cfquery datasource="#CurDS#" dbtype="#CurDSType#">
INSERT INTO CustomerFiles (CustomerID , FileData )
VALUES(12342, GetFile('D:\customerFile.txt'))
</cfquery>
(I know that is bogus syntax, but one can only wish upon a star)
HugoSchmidt Guest
-
Return value of 'serial' column on insert
Hi all, I have several tables with an 'id' column which is a simple 'serial unique' type. Often when I insert a record the next thing I need is... -
insert a hyperlink column to datgrid
how can I programmatically insert an optional hyperlink column into my datagrid which is currently being created from design tags I am trying... -
Index on Computed Column and ADO Insert
Thanks nntp! <nntp> wrote in message news:#x9nW5OQDHA.1560@TK2MSFTNGP12.phx.gbl... was INSERT ON ARITHABORT with -
Have server get value for column on Insert?
Consider: CREATE TABLE Transactions ( TransactionGUID uniqueidentifier, TransactionNumber int, TransactionDate, SessionGUID, ...) CREATE... -
Which is the best column to insert index...
...in a "linking" table? T1 ---------- Id--Name 1 -- xav 2 -- fab T2 ---------- -
Sojovi #2
Re: INSERT file to column
Using a DTS, but you can't call it from CF, you have to use dtsrun (from
command line).
With BULK INSERT you have to get all the values to insert in the table inside
the txt file.
WRITETEXT, but you have to use preservesinglequotes anyway.
Regards
Sojovi Guest
-
PaulH *ACE* #3
Re: INSERT file to column
Sojovi wrote:
what makes you say that? we do it all the time. you can easily call any DTS job> Using a DTS, but you can't call it from CF, you have to use dtsrun (from
> command line).
from within a sp or even call it via COM.
PaulH *ACE* Guest
-
Sojovi #4
Re: INSERT file to column
OK, don't get angry, thanks for let me know that. Take it easy, it's a forum, not a class room.
Regards
Sojovi Guest
-
Sojovi #5
Re: INSERT file to column
And would be a good idea that you write how we can do it.... if not, why are you posting messages here ?
Best regards
Sojovi Guest
-
HugoSchmidt #6
Re: INSERT file to column
Thanks all, I just did a rereplace() instead of the PreserveSingleQuotes() and that worked fine. It may be a patch, but it did the job.
HugoSchmidt Guest



Reply With Quote

