Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > sql server programming > november 2004 >

sql server programming : ODBC error 208 (42S02) Invalid object name


jvrakesh NO[at]SPAM yahoo.com
11/18/2004 12:18:24 PM
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
steven_kielkucki NO[at]SPAM harte-hanks.com
3/18/2005 7:46:15 AM
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



[quoted text, click to view]
AddThis Social Bookmark Button