View Single Post
  #1 (permalink)  
Old November 30th, 2003, 10:26 AM
pankaj_daga pankaj_daga is offline
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sql query question.

Hi everyone,

I am trying to do a select sub-query, but for some reason it is not working out.

I have the following stored procedure:

CREATE MyProcedure
@newID int,
@oldID int
AS

INSERT INTO MyTable(ExperimentID, Threshold, Energy) VALUES(@newID, Select Threshold, Energy from OldTable where ExperimentID = @oldID)

This mixing of a given value with a subquery does not seem to work. However, there must be a mechanism to do this. Does anyone has some experience with something like this and can maybe help me.

Thanks a lot.

Cheers,
Pankaj