Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert query issues

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
CA
Hi i have a table called products that when in the ASP if a condition is met, i need to insert into the product table new records from vendorID=305 from the product table. so basically i'm inserting new reords that are identical to records that already exist in the table but just setting the VendorID to a new id. This is what i have which doesn't seem to work: i'm trying to insert all records for vendorID=305 into the product table with vendorID equal to 304. Any suggestions

INSERT INTO Product
(VendorID
,ProductName
,ProductDescription)
VALUES
(304, (Select
,ProductName as ProductName
,ProductDescription as ProductDescription
From Product where vendorID=305))
 
Since this is a sql query issue, I recommend you post this in the SQL Server forum. Oh wait... you already did that!

thread183-1292073

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
I'm not certain, but maybe this:
Code:
INSERT INTO Product
           (VendorID
           ,ProductName
           ,ProductDescription)
      (Select 304 as NewVendorID
           ,ProductName as ProductName
           ,ProductDescription as ProductDescription
          From Product where vendorID=305)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top