If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Interbase 6 - how do I get the same results as REPLACE in MSSQL with Interbase SQL

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-18-08, 19:28
tdecker81 tdecker81 is offline
Registered User
 
Join Date: Feb 2007
Posts: 33
Question Interbase 6 - how do I get the same results as REPLACE in MSSQL with Interbase SQL

I have a field which stores the location of a tiff file.

Example \\PCT01\Images\7\368.TIF

I need to replace all of them with a new path of \\server01\applications\tsteam\data\Images\7\368.T IF

I can select them


SELECT FULLFILEPATH FROM NEWTABLE

HOW DO I SELECT EACH ONE STRIP THE REPLACE THE PART OF THE STRING I DON"T WANT AND REPLACE IT WITH THE ONE I DO WANT.

I use MS SQL everyday but cursor and replace aren't supported by Interbase so I'm not sure what I can use to replace part of a string and loop through each record and update it.

Any help would be great
Reply With Quote
  #2 (permalink)  
Old 03-22-09, 17:13
VLDG VLDG is offline
Registered User
 
Join Date: Mar 2009
Posts: 24
better way is to move to Firebird 2.1 which support REPLACE

REPLACE( <stringtosearch>, <findstring>, <replstring> )
Replaces all occurrences of <findstring> in <stringtosearch> with <replstring>.

select replace(x, ' ', ',') from y;

Firebird 2.1 Release Notes
Reply With Quote
  #3 (permalink)  
Old 03-23-09, 16:23
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,775
Does your version of firebird support the Substr and Pos functions?
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Reply With Quote
  #4 (permalink)  
Old 03-23-09, 16:46
VLDG VLDG is offline
Registered User
 
Join Date: Mar 2009
Posts: 24
Substring
How to truncate a string to a certain number of characters?

Pos : I don't know.

but there is POSITION

POSITION See below Returns the start position of the first string inside the second string, relative to the beginning of the outer string. In the second form, an offset position may be supplied so that the function returns a result relative to that position in the outer string.

POSITION( <string> IN <string> )
POSITION( <string>, <string> [, <offset-position>] )

Last edited by VLDG; 03-23-09 at 18:37.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On