Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

SQL Server - copying data

Thread Tools
 
Search this Thread
 
Old 27 May 2003, 12:23 PM
  #1  
Mojo
Scooby Regular
Thread Starter
 
Mojo's Avatar
 
Join Date: May 2000
Posts: 409
Likes: 0
Received 0 Likes on 0 Posts
Unhappy

Folks,

Can anyone tell me how I can copy the contents of a ntext field from one SQL database to another?

I'm trying to do:

UPDATE db1.dbo.table1
SET db1.dbo.table1.notesField1 = (SELECT db2.dbo.table2.notesField2 FROM db2.dbo.table2 WHERE db2.dbo.table2.ProjID= @ProjID)
WHERE db1.dbo.table1.ID = @ID

But I keep getting the really helpful message:

Error 279: The text, ntext, and image data types are invalid in this subquery or aggregate expression.

I've tried storing the data in a local variable but I'm told I'm not allowed because:

Error 2739: The text, ntext, and image data types are invalid for local variables.

I've also tried creating a user defined function but it tells me that functions aren't allowed to return "text, ntext, and image data types"

HELP!!!

Cheers

Mojo
Old 27 May 2003, 03:10 PM
  #2  
Alec
Scooby Regular
Support Scoobynet!
 
Alec's Avatar
 
Join Date: Aug 1999
Posts: 583
Likes: 0
Received 0 Likes on 0 Posts
Post

Hi there matey

Try using ReadText() , WriteText() and UpdateText(). Functions.

Cheers

Alec
Old 27 May 2003, 03:20 PM
  #3  
Mojo
Scooby Regular
Thread Starter
 
Mojo's Avatar
 
Join Date: May 2000
Posts: 409
Likes: 0
Received 0 Likes on 0 Posts
Post

Cheers fella

Just found out about the UPDATETEXT methoid and written a method using it that does what I want. I really should get round to reading the book sometime

Mojo
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JonMc
Subaru Parts
22
06 February 2016 09:50 PM
Sam Witwicky
Engine Management and ECU Remapping
17
13 November 2015 10:49 AM
IAN WR1
ScoobyNet General
8
28 September 2015 08:14 PM
Nick_Cat
Computer & Technology Related
2
26 September 2015 08:00 AM
Littleted
Computer & Technology Related
0
25 September 2015 08:44 AM



Quick Reply: SQL Server - copying data



All times are GMT +1. The time now is 10:54 AM.