I could tell you, but I'd have to kill you.

Heh, nah, we covered all this a while back, and INSERT INTO was discussed
but discarded for some reason.

As we've seen already this morning, I'm a bit foggy so I can't remember the
reason. I'm assuming it must have been a good one  but it seems that the
Mail Archive is currently down.

> -----Original Message-----
> From: Adrian Lynch [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2003 11:45
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ cf-dev ] OT: SQL: copying text columns
> 
> 
> Not an answer, but what was the reason for using cursors?
> 
> Ade
> 
> -----Original Message-----
> From: Rich Wild [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2003 11:24
> To: '[EMAIL PROTECTED]'
> Subject: [ cf-dev ] OT: SQL: copying text columns
> 
> 
> Hi all,
> 
> I have a Stored Procedure that copies rows in a SQL 7 
> database back into the
> same table, but with a different primary key, so that a user 
> can quickly
> clone and edit records in an application. This SP uses 
> cursors to achieve
> this (as we discussed on this list a while back)
> 
> This works fine, but now one of the columns that needs to be 
> copies is of
> the TEXT datatype, which can't be set to a local variable. So 
> this means I
> can't do this:
> 
> DECLARE @group_name VARCHAR(250), @group_description TEXT
> DECLARE groupCursor CURSOR
> LOCAL
> FOR 
>       SELECT group_name, group_description
>       FROM groups
>       WHERE group_id = @oldgroup
> 
> OPEN groupCursor
> FETCH NEXT FROM groupCursor INTO @group_name,@group_description
> WHILE @@FETCH_STATUS = 0
> BEGIN
>       INSERT INTO groups(group_name, group_description)
>       VALUES(@group_name,@group_description)
> FETCH NEXT FROM groupCursor INTO @group_name,@group_description
> END
> CLOSE groupCursor
> DEALLOCATE groupCursor        
> 
> 
> Can anyone think of another way to do this?
> 
> ta.   
>       
> 
> -------------------------------------------------------
> Rich Wild
> Senior Web Developer
> 
> -------------------------------------------------------
> e-mango                       Tel: 01202 755 300
> Gild House                      Fax: 01202 755 301
> 74 Norwich Avenue West
> Bournemouth                   Mailto:[EMAIL PROTECTED]
> BH2 6AW, UK                      http://www.e-mango.com
> -------------------------------------------------------
> This message may contain information which is legally
> privileged and/or confidential.  If you are not the
> intended recipient, you are hereby notified that any
> unauthorised disclosure, copying, distribution or use
> of this information is strictly prohibited. Such
> notification notwithstanding, any comments, opinions,
> information or conclusions expressed in this message
> are those of the originator, not of e-mango.com ltd,
> unless otherwise explicitly and independently indicated
> by an authorised representative of e-mango.com ltd.
> -------------------------------------------------------
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to