Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sadiqmodan
Starting Member
16 Posts |
Posted - 2010-09-01 : 05:49:14
|
Hello, I have sorting problem in SQL for text data.I have data in table like below:================================AAtotchipv(389)+v(392)Q1 Alliant Insurance Services accessibility -Q1 Over The Past Seven Days Q1a. Miles Driven Per YearQ1b. First Brand To Come To Mind - UnaidedQ1_1 Optimum WiFi Awareness SummaryQ.1 Organization TypeQD1 Marital statusQSC1a Age of ChildrenQ2. Relationship With AonQ2. Which of the following broker.Q2a. Unaided Ad AwarenessQ2-3. Would Consider - Maintenance WorkQ.2_3 Importance of Workstation Manufacturer CharacteristicsQSC2 OccupationQS2. Repair WorkQ.2b Only Server BrandQB2b_23 Brand Imagery - Store brand - Makes me feel empoweredQ.D Decision making roleSorting Rule : [b]It should be sorted by letter and then by number /b]Please help : ) |
|
sadiqmodan
Starting Member
16 Posts |
Posted - 2010-09-01 : 09:22:26
|
Hello,Any one is there to Help me, I am stuck in this sorting issue........................:( |
 |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-09-01 : 10:09:56
|
Not sure what your problem is. Isn't the solution just thisDECLARE @foo TABLE ( [ID] INT IDENTITY(1,1) PRIMARY KEY , [field] VARCHAR(512) )INSERT @foo ([field]) SELECT 'AA'UNION SELECT 'totchip'UNION SELECT 'v(389)+v(392)'UNION SELECT 'Q1 Alliant Insurance Services accessibility -'UNION SELECT 'Q1 Over The Past Seven Days 'UNION SELECT 'Q1a. Miles Driven Per Year'UNION SELECT 'Q1b. First Brand To Come To Mind - Unaided'UNION SELECT 'Q1_1 Optimum WiFi Awareness Summary'UNION SELECT 'Q.1 Organization Type'UNION SELECT 'QD1 Marital status'UNION SELECT 'QSC1a Age of Children'UNION SELECT 'Q2. Relationship With Aon'UNION SELECT 'Q2. Which of the following broker.'UNION SELECT 'Q2a. Unaided Ad Awareness'UNION SELECT 'Q2-3. Would Consider - Maintenance Work'UNION SELECT 'Q.2_3 Importance of Workstation Manufacturer Characteristics'UNION SELECT 'QSC2 Occupation'UNION SELECT 'QS2. Repair Work'UNION SELECT 'Q.2b Only Server Brand'UNION SELECT 'QB2b_23 Brand Imagery - Store brand - Makes me feel empowered'UNION SELECT 'Q.D Decision making role'-- Ordered by letter then number???SELECT [field] FROM @foo ORDER BY [field] Please post sample table structure if that's not correct.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-09-01 : 10:10:20
|
resultsAAQ.1 Organization TypeQ.2_3 Importance of Workstation Manufacturer CharacteristicsQ.2b Only Server BrandQ.D Decision making roleQ1 Alliant Insurance Services accessibility -Q1 Over The Past Seven Days Q1_1 Optimum WiFi Awareness SummaryQ1a. Miles Driven Per YearQ1b. First Brand To Come To Mind - UnaidedQ2-3. Would Consider - Maintenance WorkQ2. Relationship With AonQ2. Which of the following broker.Q2a. Unaided Ad AwarenessQB2b_23 Brand Imagery - Store brand - Makes me feel empoweredQD1 Marital statusQS2. Repair WorkQSC1a Age of ChildrenQSC2 Occupationtotchipv(389)+v(392) Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|
|