The first one didn't work because you were creating the temp
table in a SQL
string and executing it, so the temp table would not exist if
you tried to
access it out of that scope.
Tom Muck
http://www.tom-muck.com/
"darrel" <notreal@nowhere.com> wrote in message
news:eo666n$r6e$1@forums.macromedia.com...
>> Well, I decided to rewrite it because, in hindsight,
I really have no
>> idea why our SP's are written as they are. I've just
beeb building them
>> off of the template the last person used.
Simplifying it as such seems to
>> work just fine:
>>
>> --------------
>
>
> Oops! Here it is:
>
> CREATE proc dbo.sp_UpdateNewsPosting
> @postingID int
>
> as
>
> /* Vars for Procedure */
> DECLARE
> @SqlRun varchar(1000)
>
> /* Update Posting Date Fields */
> UPDATE WePostingContent_NEW SET DbPostDt_prod = DbPostDt
WHERE (PostID =
> @postingID)
>
> /* Grab staging server data */
> SELECT * INTO #PostingItems from WePostingContent_NEW
WHERE (PostID =
> @postingID)
>
> /* Delete Production Data */
> DELETE FROM [pubDB].publicSite.WePostingContent_NEW
WHERE (PostID =
> @postingID)
>
> /* Move staging data to production */
> INSERT INTO [pubDB].publicSite.WePostingContent_NEW
SELECT * FROM
> #PostingItems
>
> /* Clean up */
> Drop table #PostingItems
>
> GO
>
>