﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Programming / General  / Stored Procedure with non-qualified objects / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 07:37:44 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Stored Procedure with non-qualified objects</title><link>http://www.sqlservercentral.com/Forums/Topic713327-23-1.aspx</link><description>[quote][b]davidc (5/8/2009)[/b][hr]Dynamic SQL does indeed work. However, the report stored proc cannot be executed in that manner. It has too many statements.[/quote]Why do you say that?  I've done reports in dynamic SQL with over 100,000 lines without any real problem.[quote] We were hoping for a system solution rather than a programming solution.[/quote]I don't know of any non-code solution and I doubt that there is one.  T-SQL just isn't very flexible about this, post-compile.</description><pubDate>Fri, 08 May 2009 15:39:47 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Stored Procedure with non-qualified objects</title><link>http://www.sqlservercentral.com/Forums/Topic713327-23-1.aspx</link><description>Dynamic SQL does indeed work. However, the report stored proc cannot be executed in that manner. It has too many statements. We were hoping for a system solution rather than a programming solution.</description><pubDate>Fri, 08 May 2009 14:33:30 GMT</pubDate><dc:creator>DavidC-WNY</dc:creator></item><item><title>RE: Stored Procedure with non-qualified objects</title><link>http://www.sqlservercentral.com/Forums/Topic713327-23-1.aspx</link><description>Hmmm, actually. now I am not sure that my compile-time/run-time binding explanation was correct.  However, I still do think that dynamic SQL would work.</description><pubDate>Fri, 08 May 2009 14:31:43 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Stored Procedure with non-qualified objects</title><link>http://www.sqlservercentral.com/Forums/Topic713327-23-1.aspx</link><description>The problem is that for the most part, objects get bound at compile-time, not run-time.  True #temp tables get some kind of workaround for that, but a table like YourSchema.tmp, is probably not bindable at run-time from static SQL.  One possible solution that will probably work is Dynamic SQL.</description><pubDate>Fri, 08 May 2009 14:12:00 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>Stored Procedure with non-qualified objects</title><link>http://www.sqlservercentral.com/Forums/Topic713327-23-1.aspx</link><description>Hello,We are running SQL Server 2008 using Windows Authentication. I have a couple of stored procedures created in the dbo schema for reporting. The users are executing the SPs from a VB front end. The first sp executed is to create a tmp table in the logged on users default schema. No problem, the table is created. The next stored procedure is called to insert into that table and an error is thrown stating it can't find the object of the tmp table. Looking in SMS, the table is there in the correct database, qualified by the correct username. The stored procs just cannot insert into or select from that table. I found a small blurb about non qualified objects referenced in a stored proc are only searched for in the stored proc owners schema. We've tried Execute AS with various options without success. We can't hardcode the qualifier in the stored procs because we want several users to run the report at the same time. Is there anyway around this situation other than rewriting the report process? Thanks in advance for your help.</description><pubDate>Fri, 08 May 2009 13:59:58 GMT</pubDate><dc:creator>DavidC-WNY</dc:creator></item></channel></rss>