Hi,
Got a quick problem! I've created a stored procedure that takes the input, fetches more data then does an INSERT statement:
As you can see, this will do two SELECTs within this procedure.
Is there a way to combine these two SELECTs into one, whilst still letting me use the returned values as variables?
This is a very basic example of what I'm needing. The actual one does eight SELECTs!
Got a quick problem! I've created a stored procedure that takes the input, fetches more data then does an INSERT statement:
Code:
CREATE PROCEDURE Duplicate
@Account nvarchar(20)
AS
DECLARE @Email nvarchar(50), @Hint nvarchar(50)
SET @Email = (SELECT Email FROM Users WHERE Account=@Account)
SET @Hint = (SELECT Hint FROM Users WHERE Account=@Account)
INSERT INTO Users(Account, Email, Hint) VALUES('[1]'+@Account, @Email, @Hint)
As you can see, this will do two SELECTs within this procedure.
Is there a way to combine these two SELECTs into one, whilst still letting me use the returned values as variables?
This is a very basic example of what I'm needing. The actual one does eight SELECTs!
Last edited: