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 2005 Forums
 Transact-SQL (2005)
 SP object name error

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-01-29 : 06:19:47
Hi I am creating an SP which creates a table and then puts a count of that table in a log

i.e.
CREATE SP_Test
as
select * from Table1 into Test_Table

insert into Log
select '1' as ID, 'Test_Table' as Table_Name, count(*) as Total
from Test_Table

print 'Test_Table' created

Error received:
Msg 208, Level 16, State 6
Invalid Object name 'Test_Table'

The error indicate the object doesn't exist, but the object will be created when the SP is executed. Any ideas how I can incorporate the Insert into Log statement into my SP without having any errors?

Thanks in advance

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-29 : 06:24:29
[code]select * into Test_Table from Table1 into Test_Table[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -