You are here: Re: Temp Table in a Stored Procedure « MsSQL Server « IT news, forums, messages
Re: Temp Table in a Stored Procedure

Posted by Erland Sommarskog on 06/21/05 00:45

(rbonin@gmail.com) writes:
> I need to select and mark 150 records at a time in a large table.
> What I'm trying to do is...
>
>
> Select top 150 xxxx into #temp from largeTable

That creates a table.

> update largeTable set marked = 1 where xxxx in #temp

That's a syntax error.

> I ended up creating the table in it's own statement
> and it is working now, I guess that insert into doesn;t
> create the table, but it doesn't throw an error either.

INSERT does not create a table, that is correct. And if the
table does not exist at that point, there will be an error.
Presumably the issue has to do with deferred name resolution.
But since you did not care to post the actual code, it is
difficult to say exactly what was going on.




--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация