Click here to Skip to main content
15,888,142 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have question like below
i want to replace string with other string ex: C:docs\test\uml this is my string and i want to replace this by like this C:docs\firstname-lastname \uml
table is as below

author table
authorid firstname lastname bookslocation
1 xyz abc C:\docs\test\uml
2 opq def C:\downloads\test\uml

now i want result as below

authorid firstname lastname bookslocation
1 xyz abc C:\docs\xyz-abc\uml
2 opq def C:\downloads\opq-def\uml

here i want to replace test with firstname and lastname of author

please help me on this...
Posted

1 solution

1. In SQL you can concatenate strings by simply add them together:
SQL
select firstname + '-' + lastname

2. SQL also has a REPLACE[^] method:
SQL
select replace(base_path, 'test', firstname + '-' + lastname)

(base_path is your c:\docs\test\uml path...)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900