Click here to Skip to main content
16,004,782 members
Home / Discussions / Database
   

Database

 
QuestionSQL Server Code Generation Pin
billythekidney20-Apr-10 4:54
billythekidney20-Apr-10 4:54 
AnswerRe: SQL Server Code Generation Pin
Mycroft Holmes20-Apr-10 12:32
professionalMycroft Holmes20-Apr-10 12:32 
GeneralRe: SQL Server Code Generation Pin
billythekidney20-Apr-10 22:26
billythekidney20-Apr-10 22:26 
Questionhow to write insert querry for two tables Pin
developerit20-Apr-10 3:56
developerit20-Apr-10 3:56 
AnswerRe: how to write insert querry for two tables Pin
Ashfield20-Apr-10 9:03
Ashfield20-Apr-10 9:03 
QuestionSQL Server 2008 R2? Is the upgrade from 2008 free? Pin
DoctorOwl19-Apr-10 14:38
DoctorOwl19-Apr-10 14:38 
AnswerRe: SQL Server 2008 R2? Is the upgrade from 2008 free? Pin
Michel Godfroid20-Apr-10 4:15
Michel Godfroid20-Apr-10 4:15 
QuestionHow to do a quick / generic pivot? Pin
DoctorOwl18-Apr-10 16:25
DoctorOwl18-Apr-10 16:25 
AnswerRe: How to do a quick / generic pivot? Pin
Mycroft Holmes19-Apr-10 17:03
professionalMycroft Holmes19-Apr-10 17:03 
QuestionIs it posible to make several relations between two tables in SQL query ? Pin
H.R17-Apr-10 4:39
H.R17-Apr-10 4:39 
AnswerRe: Is it posible to make several relations between two tables in SQL query ? Pin
PIEBALDconsult17-Apr-10 4:59
mvePIEBALDconsult17-Apr-10 4:59 
AnswerRe: Is it posible to make several relations between two tables in SQL query ? Pin
Stanciu Vlad17-Apr-10 5:33
Stanciu Vlad17-Apr-10 5:33 
GeneralRe: Is it posible to make several relations between two tables in SQL query ? Pin
PIEBALDconsult17-Apr-10 5:36
mvePIEBALDconsult17-Apr-10 5:36 
GeneralRe: Is it posible to make several relations between two tables in SQL query ? Pin
Stanciu Vlad17-Apr-10 5:42
Stanciu Vlad17-Apr-10 5:42 
QuestionProcedure is using server resource but unmanaged how to managed that... Pin
Sasmi_Office16-Apr-10 23:35
Sasmi_Office16-Apr-10 23:35 
AnswerRe: Procedure is using server resource but unmanaged how to managed that... Pin
dan!sh 17-Apr-10 3:44
professional dan!sh 17-Apr-10 3:44 
GeneralRe: Procedure is using server resource but unmanaged how to managed that... Pin
Sasmi_Office17-Apr-10 4:19
Sasmi_Office17-Apr-10 4:19 
GeneralRe: Procedure is using server resource but unmanaged how to managed that... Pin
dan!sh 17-Apr-10 5:45
professional dan!sh 17-Apr-10 5:45 
AnswerRe: Procedure is using server resource but unmanaged how to managed that... Pin
Ashfield17-Apr-10 6:12
Ashfield17-Apr-10 6:12 
QuestionSort Results ignoring symbols like ! ? * " Pin
AlexeiXX316-Apr-10 16:14
AlexeiXX316-Apr-10 16:14 
AnswerRe: Sort Results ignoring symbols like ! ? * " [modified] Pin
Andy_L_J16-Apr-10 18:03
Andy_L_J16-Apr-10 18:03 
Ok, I did this:

DECLARE @Table AS Table(
    ID Int,
    [Name] nVarChar(50))
    
INSERT @Table(ID, Name)
  VALUES(1, '"The less you talk..."') 
INSERT INTO @Table
  SELECT 2, 'The long and...'
INSERT INTO @Table
  SELECT 3, '-ABC of Math'
INSERT INTO @Table
  SELECT 4, '*Something Else'


          
SELECT * FROM @Table
ORDER BY (SELECT CASE WHEN (UNICODE(SUBSTRING(Name,1,1))< 123)
                      THEN UNICODE(SUBSTRING(Name, 2,1))
                      ELSE Name End) ASC


Result:

ID      Name
-----------------------------
3	-ABC of Math
4	*Something Else
1	"The less you talk..."
2	The long and...


The results match what you specified, but what if there is more than one 'special' character at the beginning of the string?

EDIT:

If you add more data you will find the following:

DECLARE @Table AS Table(
    ID Int,
    [Name] nVarChar(50))
    
INSERT @Table(ID, Name)
  VALUES(1, '"The less you talk..."') 
INSERT INTO @Table
  SELECT 2, 'The long and...'
INSERT INTO @Table
  SELECT 3, '-ABC of Math'
INSERT INTO @Table
  SELECT 4, '*Something Else'
INSERT INTO @Table
  SELECT 4, '? A Question'
INSERT INTO @Table
  SELECT 4, '#Regions'
INSERT INTO @Table
  SELECT 4, 'Sometimes you are right.'
INSERT INTO @Table
  SELECT 4, 'Little creatures'

          
SELECT * FROM @Table
ORDER BY (SELECT CASE WHEN (UNICODE(SUBSTRING(Name,1,1))< 123)
                      THEN UNICODE(SUBSTRING(Name, 2,1)) 
                      ELSE Name  End
              ) ASC


Result:
ID	Name
-------------------------------
4	? A Question
3	-ABC of Math
4	#Regions
4	*Something Else
1	"The less you talk..."
2	The long and...
4	Little creatures
4	Sometimes you are right.


This may not be ideal...
I don't speak Idiot - please talk slowly and clearly

'This space for rent'

Driven to the arms of Heineken by the wife
modified on Saturday, April 17, 2010 12:18 AM

GeneralRe: Sort Results ignoring symbols like ! ? * " Pin
AlexeiXX316-Apr-10 18:35
AlexeiXX316-Apr-10 18:35 
GeneralRe: Sort Results ignoring symbols like ! ? * " Pin
Andy_L_J16-Apr-10 19:02
Andy_L_J16-Apr-10 19:02 
AnswerRe: Sort Results ignoring symbols like ! ? * " Pin
Eddy Vluggen17-Apr-10 0:37
professionalEddy Vluggen17-Apr-10 0:37 
Questionhow to read data from pdf file Pin
raghvendrapanda16-Apr-10 1:37
raghvendrapanda16-Apr-10 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.