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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Insert into statement

Author  Topic 

karuna
Aged Yak Warrior

582 Posts

Posted - 2005-04-13 : 10:25:01
I have a select statement and use insert into along with it to input data in the table.

Insert into Reseller (ResellerAccountNo,ResellerName)
Select ResellerAccountNo,ResellerCustomerName from TempView

I need to change the select into something like this:
Select Distinct RowId,ResellerAccountNo,ResellerCustomerName from TempView

But I dont have a valid column for RowId in Reseller Table, So how can I use the insert into statement here.

Karunakaran
___________
NOTHING IS IMPOSSIBLE, IMPOSSIBLE JUST TAKES LONGER...

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2005-04-13 : 10:42:11
Insert into Reseller (ResellerAccountNo,ResellerName)
Select a.ResellerAccountNo,a.ResellerCustomerName from
(Select Distinct RowId,ResellerAccountNo,ResellerCustomerName from TempView) a

Does this work? (havent tried it)
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2005-04-13 : 11:22:06
Looks like it will work.I'll give it a try and let you know.

Karunakaran
___________
NOTHING IS IMPOSSIBLE, IMPOSSIBLE JUST TAKES LONGER...
Go to Top of Page
   

- Advertisement -