I have this `Sql` puzzle i'm using Sql server 2005 

the following query works fine 

```
 DECLARE @query VARCHAR(200)
 DECLARE @colname varchar(50) 
     CREATE TABLE #temp (ID INT IDENTITY PRIMARY KEY , value VARCHAR(50))
       INSERT INTO #temp VALUES ('first')
       SET @colname = 'myCol'
       SET @query = 'SELECT value AS' + @colname + ' FROM #temp'
        EXEC(@query)
     DROP TABLE #temp

```

**BUT** 

if i do this 

```
  SET @colname = (SELECT value FROM tablename WHERE id = 12) --valid selection 

```

or 

```
  SELECT @colname = value FROM tablename WHERE id = 12 --valid selection 

```

I don't get any result , i get a message saying :

```
  (1 row(s) affected)

```

AND ERROR Message: 

```
  Msg 102, Level 15, State 1, Line 1
  Incorrect syntax near '1'.

```

Any body knows what is going on with this thing Thanks