Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Another Dynamic SQL Problem

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-14 : 15:29:34
AlexCold writes "Why second query don't works for me and how it can be fixed?

declare @myID int, @SQL varchar(50)

-- First Query (works just fine!)
SELECT top 1 @myID=id FROM myTable

-- Second query
select @SQL='SELECT top 1 @myID=id FROM myTable'

exec (@SQL)"
   

- Advertisement -