You are here: Re: Query Produces Jumbled output / output not in sequence « MsSQL Server « IT news, forums, messages
Re: Query Produces Jumbled output / output not in sequence

Posted by David Portas on 05/17/05 00:37

Re-read what I said before. Now look at your code:

<snip>

INSERT INTO #tbl_Script
VALUES ('INSERT INTO #tbl_TestAttr(AttrRef, TestRef, Seq, PrtRef,
AttrType, Value, TermDate, AttrID, DefSw, WantSw, ActSw)')

INSERT INTO #tbl_Script
VALUES ('VALUES (' + @AttrStr + ', ' + @TestRefStr + ', ' +
@SeqStr
+ ', ' + @PrtStr + ', ' + @AttrTypeStr + ', ' + @Value + ', ' +
@TermDateStr + ', ' + @AttrIDStr + ', ' + @DefStr + ', ' + @WantStr
+
', '+ @ActSwStr + ')')

</snip>

The "INSERT" and "VALUES" parts are in separate rows, but when you query the
table:

SELECT t.ScriptText
FROM #tbl_Script t

You have no ORDER BY clause! So you can't expect to see the result in the
same order you inserted the data.

--
David Portas
SQL Server MVP
--

 

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

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