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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert with Select

Status
Not open for further replies.

Bell1991

Programmer
Aug 20, 2003
386
US
I have the following query:

declare @numID int
set @numID = 66

Insert into tblA (numID, txtName, txtAddress) values (Select @numID as numID, txtName, txtAddress from tblB where numID = @numID)

Is this possible? I am getting an error message - so i suspect it isn't.. but any ideas on how to make it work?

Thanks
 
try dropping the values

you can use select or values not both

Insert into tblA (numID, txtName, txtAddress)Select @numID as numID, txtName, txtAddress from tblB where @numID=numID


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top