Is it possible to declare and use a table name please. I am trying to get this type of query to run, but cannot find the right syntax:
Thanks!Code:DECLARE @TableName nvarchar IF @MyPassedInBitVariable = 0 SET @TableName = [MyDB..MyTableName1] ELSE SET @TableName = [MyDB..MyOtherTableName2] SELECT @TableName.Column1 FROM @TableName




Reply With Quote