Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Copy a record using a sp

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2005-10-06 : 10:53:24
In a sp I want to select a record from my sql table and copy it to a new record in the same table, changing the value of one of the fields. The value of this field will come from my web page. Is this possible ?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-10-06 : 10:56:35
insert into table1 (columns, inputColumn)
select columns, @InputColumn
from table1
where ....

Go with the flow & have fun! Else fight the flow
Go to Top of Page

sultan_m
Starting Member

1 Post

Posted - 2006-06-15 : 03:26:03
I want to copy one record of the table as another record in the same table but changing one field, as that field has to be unique in the table.

what's the best way to copy the record and change only the one field in the new record?

thanks.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-15 : 03:35:35
Update yourTable
Set newcol=Oldcol

Otherwise post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -