Click here to Skip to main content
15,926,959 members
Home / Discussions / Database
   

Database

 
QuestionADO with native C++ Pin
Chris Meech16-Nov-07 11:26
Chris Meech16-Nov-07 11:26 
QuestionI ask for help on the following SQl statement Pin
Vimalsoft(Pty) Ltd16-Nov-07 4:38
professionalVimalsoft(Pty) Ltd16-Nov-07 4:38 
AnswerRe: I ask for help on the following SQl statement Pin
andyharman16-Nov-07 8:25
professionalandyharman16-Nov-07 8:25 
QuestionPlease help on making a order transaction Pin
tgreeny16-Nov-07 1:59
tgreeny16-Nov-07 1:59 
AnswerRe: Please help on making a order transaction Pin
Pete O'Hanlon16-Nov-07 2:33
mvePete O'Hanlon16-Nov-07 2:33 
QuestionReplace Text Pin
Mohammed Elkholy16-Nov-07 1:26
Mohammed Elkholy16-Nov-07 1:26 
AnswerRe: Replace Text Pin
Shpendh16-Nov-07 1:48
Shpendh16-Nov-07 1:48 
AnswerFinally Something i can help with Pin
Support12316-Nov-07 2:11
Support12316-Nov-07 2:11 
This is not something that happens to me every day... for once i can finally give help to someone else and not be the one asking the question Smile | :)

SELECT YourStudentNumberColumn AS [Test],<br />
		'01' + SUBSTRING(YourStudentNumberColumn,3,LEN(YourStudentNumber) - 2) AS [TestAfterUpdate]


Notice the 3 in the substring, this is the start position. The LEN(YourStudentNumber) - 2 is the amount of character to use. So it will start at position 3 being the first '-' in your student number and end at the end of the student number as it gets the length of the YourStudentNumber subtracts 2 as you start at position 3 (the first '-'). If this is unclear run the query in sql and change the '- 2' to '- 3' and you will see what it does.

the SUBSTRING works like this.
Substring(YourValue, StartPosition(1 for beginning of your value), AmountOfCharacters)

I added the select statement so that you can make sure that this is the correct value that you need.

If it is... you can run it like this for the UPDATE:
UPDATE YourTableName<br />
SET YourStudentNumberColumnName = '01' + SUBSTRING(YourStudentNumberColumnName,3,LEN(YourStudentNumber) - 2) 


"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

GeneralRe: Finally Something i can help with Pin
Mohammed Elkholy16-Nov-07 2:46
Mohammed Elkholy16-Nov-07 2:46 
Questiontriggers Pin
dandamudi padma16-Nov-07 1:00
dandamudi padma16-Nov-07 1:00 
AnswerRe: triggers Pin
DerekFL16-Nov-07 4:44
DerekFL16-Nov-07 4:44 
AnswerRe: triggers Pin
DerekFL16-Nov-07 4:56
DerekFL16-Nov-07 4:56 
GeneralRe: triggers Pin
dandamudi padma16-Nov-07 17:57
dandamudi padma16-Nov-07 17:57 
QuestionDB transfer Pin
mehrdadc4816-Nov-07 0:21
mehrdadc4816-Nov-07 0:21 
AnswerRe: DB transfer Pin
ChandraRam16-Nov-07 0:35
ChandraRam16-Nov-07 0:35 
Questionright align Pin
Support12315-Nov-07 23:29
Support12315-Nov-07 23:29 
AnswerRe: right align Pin
joemonvarghese15-Nov-07 23:48
joemonvarghese15-Nov-07 23:48 
AnswerRe: right align Pin
Joe16-Nov-07 0:04
Joe16-Nov-07 0:04 
AnswerRe: right align Pin
Krish - KP16-Nov-07 0:18
Krish - KP16-Nov-07 0:18 
AnswerRe: right align Pin
ChandraRam16-Nov-07 0:34
ChandraRam16-Nov-07 0:34 
GeneralRe: right align Pin
Support12316-Nov-07 1:50
Support12316-Nov-07 1:50 
Questionurgent: can anyone plz tell the error in santex of SQL Query Pin
mavii15-Nov-07 22:28
mavii15-Nov-07 22:28 
AnswerRe: urgent: can anyone plz tell the error in santex of SQL Query Pin
Rocky#15-Nov-07 22:38
Rocky#15-Nov-07 22:38 
AnswerRe: urgent: can anyone plz tell the error in santex of SQL Query Pin
InsDev15-Nov-07 22:46
InsDev15-Nov-07 22:46 
AnswerRe: urgent: can anyone plz tell the error in santex of SQL Query Pin
Krish - KP15-Nov-07 23:03
Krish - KP15-Nov-07 23:03 

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.