Hi! I would be grateful for any advise regarding what I'm doing wrong.. My
brain is stuck. Probably some stupid simple mistake I don't see. Thanks very
much for your efforts!
Martin
I have this code:
DECLARE
@ContactID varchar(10),
@AddressID int,
@cmdSQL varchar(500)
Set @ContactID = '12'
SET @cmdSQL = 'SELECT AddressID FROM i2b_ash_contact WHERE ContactID = ' +
@ContactID
EXEC (@cmdSQL)
But how do I store the value returnd by EXEC (@cmdSQL) in the variable
@AddressID????
Tried several things unsucessfully e.g.:
EXEC @AddressID = @cmdSQL
SET @ AddressID = EXEC(@cmdSQL)
Am I really so stupid that I can't see what I'm doing wrong???
brain is stuck. Probably some stupid simple mistake I don't see. Thanks very
much for your efforts!
Martin
I have this code:
DECLARE
@ContactID varchar(10),
@AddressID int,
@cmdSQL varchar(500)
Set @ContactID = '12'
SET @cmdSQL = 'SELECT AddressID FROM i2b_ash_contact WHERE ContactID = ' +
@ContactID
EXEC (@cmdSQL)
But how do I store the value returnd by EXEC (@cmdSQL) in the variable
@AddressID????
Tried several things unsucessfully e.g.:
EXEC @AddressID = @cmdSQL
SET @ AddressID = EXEC(@cmdSQL)
Am I really so stupid that I can't see what I'm doing wrong???
Comment