[quoted text, click to view] Derek Erb wrote:
> I can't get past this one. I am trying to import an ntext column from
> one SQL Server table to another.
>
> Set RS = Conn.Execute("SELECT * FROM COLL")
This is probably the problem. You should avoid using selstar (Select *).
Always name the columns you are retrieving. However, see below for a better
idea.
[quoted text, click to view] >
> do while not RS.EOF
> Set RSOut = Conn.Execute("SELECT ImageNotes FROM Images WHERE
> (Inventory='" & RS("Inventory") & "')")
> if not RSOut.EOF then
> lngFS = RS("Notes").ActualSize
> if (lngFS) then
> strTxt = RS.Fields.Item("Notes").GetChunk(lngFS)
> RSOut("ImageNotes").AppendChunk strTxt
> end if
> end if
> RS.MoveNext
> loop
>
> MY CODE DIES AT THE CALL TO GETCHUNK
>
> I get the following error:
>
> ADODB.Field error '800a0bb9'
>
> Arguments are of the wrong type, are out of acceptable range, or are
> in conflict with one another.
>
> Both columns are of the type ntext in both tables.
>
> I can't figure out what to try next.
>
> Help!
Are both these tables on the same SQL Server box? If so, you can use an
UPDATE statement, even if the tables are in different databases.:
sSQL = "UPDATE i SET ImageNotes = c.Notes " & _
"FROM Images i INNER JOIN COLL c ON i.Inventory=c.Inventory"
Or, the more ANSI-compliant version:
sSQL = "UPDATE Images SET ImageNotes = (SELECT " & _
Notes FROM COLL WHERE Inventory = Images.Inventory)"
Either way, simply execute it as:
Conn.Execute sSQL,,1
No need for cursors.
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"