I have several tables with the same structure e.g. for each single process. I pass two parameters from VB.NET:
- a dynamic variable '@strDynTable'
- an ID varible '@id'
I'd like to read an Uniqueidentifier (Colunm 'uid') from the current table:

@strDynTable char (30),
@id int,
declare @tmpuid uniqueidentifier;
exec('select '+@tmpuid+' = uid from '+@strDynTable+' where id ='+@id);

/* Here are some other trials ...
declare @tmpuid char(50);
select @tmpuid = uid from process_a where id=@id ->funktioniert
exec @tmpuid = spGet_uid @strDynTable, @id;
select @tmpuid = exec('select uid from '+@strCDynTable+' where id ='+@id);

I think the problem is that I have to assign the select command dynamic as a string but the Uniqueidentifier is incompatible with string or at least I did not find how ... :-(
Does anyone have an idea how I could
read a Uniqueidentifier depanding on the variables @strDynTable and @ID?
Many thanks in advance! Cheers.