Revision: 33349
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 8, 2010 04:01 by aunlead
Initial Code
eg. QuestionId QuestionCode Question IsActive 1 5 ABC 1 2 AC5 ABC2 1 3 60 ABCD 1 4 A4 ABCF 1 5 1 ABCASD 1 SELECT ( SELECT QuestionId as QuestionID, -- INT QuestionCode as QuestionCode, -- VARCHAR Question as Question, -- VARCHAR IsActive as IsActiveValue -- BIT FROM Questions WHERE IsActive = 1 ORDER BY -- [To sort varchar fields] CASE ISNUMERIC(QuestionCode) WHEN 1 THEN Replicate(CHAR(35), 100 - LEN(QuestionCode)) + QuestionCode ELSE QuestionCode END FOR XML PATH('Question'), TYPE ) FOR XML PATH('BOQuestionList'), TYPE
Initial URL
Initial Description
To sort varchar fields which contain numeric data & returning XML
Initial Title
To sort varchar fields which contain numeric data
Initial Tags
sql
Initial Language
SQL