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)
 Invalid column name while column exists

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-07 : 09:57:57
writes "I have created following stored procedure on sql server (version 7.0 no service pack) to randomly select records from the authors table:
create proc randomrecord as
declare @a int
declare @auid varchar(40)
select @a=(select rand()*23)
select au_id into #tt from authors
alter table #tt add autonumber int identity
set @auid=( select au_id from #tt where autonumber=@a )
select * from authors where au_id=@auid
drop table #tt

The stored procedure is created well but when I execute it I get the following error message:
Invalid column name 'autonumber'.
WHAT CAN BE THE PROBLEM ?"

Nazim
A custom title

1408 Posts

Posted - 2002-05-07 : 10:19:49
i have come across this more then once.

check this thread , thought it should be of some help to you http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=12488 .


--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -