You are here: Re: Update sub query « MsSQL Server « IT news, forums, messages
Re: Update sub query

Posted by --CELKO-- on 09/18/06 22:12

Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it.

>>This table having 200 records [sic]. I want to update first [sic] 20 "no" records [sic] to update to "yes" <<

Rows are not records; fields are not columns; tables are not files;
there is no sequential access or ordering in an RDBMS, so "first",
"next" and "last" are totally meaningless. If you want an ordering,
then you need to have a column that defines that ordering.

>> update reserve
set allocated='yes'
from(select allocated from reserve where allocated='no') <<

Never use the proprietary UPDATE.. FROM.. syntax; the results are
unpredictable.

Want to try again with a usable spec?

 

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

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