Click here to Skip to main content
15,892,005 members
Home / Discussions / Database
   

Database

 
GeneralRe: How to Optimize DbTransactions (C#) with SQLServer ? Pin
kadaoui el mehdi29-Jun-09 7:32
kadaoui el mehdi29-Jun-09 7:32 
AnswerRe: How to Optimize DbTransactions (C#) with SQLServer ? Pin
Niladri_Biswas30-Jun-09 5:50
Niladri_Biswas30-Jun-09 5:50 
Questionon full-text-search Pin
leone29-Jun-09 4:47
leone29-Jun-09 4:47 
Questionho to retrieve a list of dependants Pin
Anoop Brijmohun29-Jun-09 2:59
Anoop Brijmohun29-Jun-09 2:59 
AnswerRe: ho to retrieve a list of dependants [modified] Pin
Niladri_Biswas29-Jun-09 23:59
Niladri_Biswas29-Jun-09 23:59 
GeneralRe: ho to retrieve a list of dependants Pin
Anoop Brijmohun5-Jul-09 20:16
Anoop Brijmohun5-Jul-09 20:16 
QuestionConvert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 0:31
professionalVimalsoft(Pty) Ltd29-Jun-09 0:31 
AnswerRe: Convert String and Sort the the Intergers in a String ASC Pin
Aman Bhullar29-Jun-09 2:20
Aman Bhullar29-Jun-09 2:20 
use need something like
DROP FUNCTION IF EXISTS sortString;
DELIMITER |
CREATE FUNCTION sortString(inString TEXT) RETURNS TEXT
BEGIN
  DECLARE delim CHAR(1) DEFAULT ','; -- delimiter 
  DECLARE strings INT DEFAULT 0;     -- number of substrings
  DECLARE forward INT DEFAULT 1;     -- index for traverse forward thru substrings
  DECLARE backward INT;   -- index for traverse backward thru substrings, position in calc. substrings
  DECLARE remain TEXT;               -- work area for calc. no of substrings
-- swap areas TEXT for string compare, INT for numeric compare
  DECLARE swap1 TEXT;                 -- left substring to swap
  DECLARE swap2 TEXT;                 -- right substring to swap
  SET remain = inString;
  SET backward = LOCATE(delim, remain);
  WHILE backward != 0 DO
    SET strings = strings + 1;
    SET backward = LOCATE(delim, remain);
    SET remain = SUBSTRING(remain, backward+1);
  END WHILE;
  IF strings < 2 THEN RETURN inString; END IF;
  REPEAT
    SET backward = strings;
    REPEAT
      SET swap1 = SUBSTRING_INDEX(SUBSTRING_INDEX(inString,delim,backward-1),delim,-1);
      SET swap2 = SUBSTRING_INDEX(SUBSTRING_INDEX(inString,delim,backward),delim,-1);
      IF  swap1 > swap2 THEN
        SET inString = TRIM(BOTH delim FROM CONCAT_WS(delim
        ,SUBSTRING_INDEX(inString,delim,backward-2)
        ,swap2,swap1
        ,SUBSTRING_INDEX(inString,delim,(backward-strings))));
      END IF;
      SET backward = backward - 1;
    UNTIL backward < 2 END REPEAT;
    SET forward = forward +1;
  UNTIL forward + 1 > strings
  END REPEAT;
RETURN inString;
END |
DELIMITER ;
 
-- example call:
SET @Xstr  = "The,quick,brown,fox,jumped,over,the,lazy,dog";
SET @Ystr  = "9,8,7,6,5,4,3,2,1";  
SET @Zstr  = "7,8,9,6,5,2,1,4,3";  
SET @str  = "3,2,3,4,2,3";
 
SELECT sortString(@str) AS s1,sortString(@Xstr) AS s2,sortString(@Ystr) AS s3,sortString(@Zstr) AS s4;


Regards
Aman Bhullar
www.arlivesupport.com[^]

GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 2:25
professionalVimalsoft(Pty) Ltd29-Jun-09 2:25 
GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Aman Bhullar29-Jun-09 3:06
Aman Bhullar29-Jun-09 3:06 
GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 3:21
professionalVimalsoft(Pty) Ltd29-Jun-09 3:21 
AnswerRe: Convert String and Sort the the Intergers in a String ASC [modified] Pin
Niladri_Biswas29-Jun-09 5:45
Niladri_Biswas29-Jun-09 5:45 
GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 5:48
professionalVimalsoft(Pty) Ltd29-Jun-09 5:48 
GeneralRe: Convert String and Sort the the Intergers in a String ASC [modified] Pin
Niladri_Biswas29-Jun-09 5:55
Niladri_Biswas29-Jun-09 5:55 
GeneralRe: Convert String and Sort the the Intergers in a String ASC Pin
Vimalsoft(Pty) Ltd29-Jun-09 5:56
professionalVimalsoft(Pty) Ltd29-Jun-09 5:56 
QuestionProblem with joining tables in MSAccess. Pin
A k ch28-Jun-09 19:32
A k ch28-Jun-09 19:32 
AnswerRe: Problem with joining tables in MSAccess. Pin
riced28-Jun-09 22:44
riced28-Jun-09 22:44 
GeneralRe: Problem with joining tables in MSAccess. Pin
A k ch28-Jun-09 23:04
A k ch28-Jun-09 23:04 
AnswerRe: Problem with joining tables in MSAccess. Pin
Niladri_Biswas28-Jun-09 23:07
Niladri_Biswas28-Jun-09 23:07 
GeneralRe: Problem with joining tables in MSAccess. Pin
A k ch28-Jun-09 23:33
A k ch28-Jun-09 23:33 
GeneralRe: Problem with joining tables in MSAccess. Pin
riced29-Jun-09 0:43
riced29-Jun-09 0:43 
GeneralRe: Problem with joining tables in MSAccess. Pin
A k ch29-Jun-09 1:00
A k ch29-Jun-09 1:00 
QuestionFLOAT vs NUMERIC for financial transaction Pin
devvvy28-Jun-09 15:23
devvvy28-Jun-09 15:23 
AnswerRe: FLOAT vs NUMERIC for financial transaction Pin
Niladri_Biswas28-Jun-09 16:37
Niladri_Biswas28-Jun-09 16:37 
GeneralRe: FLOAT vs NUMERIC for financial transaction Pin
devvvy28-Jun-09 16:41
devvvy28-Jun-09 16:41 

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.