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.
| Author |
Topic |
|
smithani
Starting Member
42 Posts |
Posted - 2007-06-11 : 16:54:35
|
| Is it possible to do an update * where in we update all the contents of the table after selecting specific rows of the same table.for ex:create table #Result(rowid int identity(1,1),cust_no int,companyname varchar(100),address varchar(200),zip varchar(9)); insert into #Result(cust_no,companyname,address,zip) where (customertype='r' and customer.comp_id ='11') group by customer.cust_no, customer.companyselect * from #Result where customerstatus='s'; after this i want to update/replace the #Result with whatever results I have from the select statment.Thanks for your replies. |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-06-11 : 16:56:15
|
| (1) I dont see the column customerstatus in your #Result table.(2) Can you explain in more detail "...with whatever results I have from the select statment"Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
smithani
Starting Member
42 Posts |
Posted - 2007-06-11 : 16:59:01
|
| I think I might have found the answer, I can just delete from the temp table the results I dont need,it will be equivalent to updating it with the rows I need. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-12 : 08:56:16
|
Thats not an update. It would be replace only MadhivananFailing to plan is Planning to fail |
 |
|
|
smithani
Starting Member
42 Posts |
Posted - 2007-06-12 : 11:10:57
|
[quote]Originally posted by madhivanan Thats not an update. It would be replace only Is there any other way, b'cos I tried to delete but it doesn't restore the seed values for identity fields. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-12 : 11:20:03
|
| Instead of Deleting, truncate itTruncate table tablenameand then insert dataMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|