Discussion:
ODBC error 208 (42S02) Invalid object name
(too old to reply)
Rakki
2004-11-18 20:18:24 UTC
Permalink
Hi ,

I get the error ODBC error 208 (42S02) Invalid object name when I
execute this
Due to the multiple conditions I had to use the temp table, Depending
on the conditions email is send for that group only.
insert into #emp(emp,empname,group)select empid,emplyeename,groupnum
from emp


EXEC Master..xp_sendmail
@recipients = 'johnd',
@query = 'SELECT * FROM #Emp where group=1',
@subject = 'SQL Server Report',
@message = 'The contents of Emp:',
@attach_results = 'TRUE', @width = 250

EXEC Master..xp_sendmail
@recipients = 'johnd',
@query = 'SELECT * FROM #Emp where group=2',
@subject = 'SQL Server Report',
@message = 'The contents of Emp:',
@attach_results = 'TRUE', @width = 250

----
----

I continue for all the groups. I have more than 10 groups like this.

can anyone please help me to solve this.

Thanks
Rakki
s***@harte-hanks.com
2005-03-18 15:46:15 UTC
Permalink
You've probably resolved this by this time but I'll mention it anyway.
The @query statement should have a fully qualified table name
"database.owner.table". If you must use a temporary table it should be
a global temporary table to allow you to reference it using the fully
qualified name of "tempdb.dbo.##GlobalTempTable". A standard temp table
is difficult to use as it is only accessible by the spid that created
it and the name is appended with a random number (e.g.
"#Test_______________________________________________________________________________________________________________000000022798";
this is what was found in the tempdb..sysobjects table when I created a
standard temporary table called "#Test" in another database).

Regards,
Steven Kielkucki
MCSE, MCDBA, CCNA
Post by Rakki
Hi ,
I get the error ODBC error 208 (42S02) Invalid object name when I
execute this
Due to the multiple conditions I had to use the temp table, Depending
on the conditions email is send for that group only.
insert into #emp(emp,empname,group)select empid,emplyeename,groupnum
from emp
EXEC Master..xp_sendmail
@recipients = 'johnd',
@query = 'SELECT * FROM #Emp where group=1',
@subject = 'SQL Server Report',
@message = 'The contents of Emp:',
@attach_results = 'TRUE', @width = 250
EXEC Master..xp_sendmail
@recipients = 'johnd',
@query = 'SELECT * FROM #Emp where group=2',
@subject = 'SQL Server Report',
@message = 'The contents of Emp:',
@attach_results = 'TRUE', @width = 250
----
----
I continue for all the groups. I have more than 10 groups like this.
can anyone please help me to solve this.
Thanks
Rakki
Loading...