Home > BI, Code, Tips > Instr() Equivalent in SQL Server

Instr() Equivalent in SQL Server

While delving into the wonderful (*ahem) world of SQL server, I was attempting to parse through some text fields and needed to find an alternative to the Oracle instr() function.

The syntax for the INSTR Oracle function is:


instr( string1, string2 [, start_position [, nth_appearance ] ] )

string1 is the string to search.

string2 is the substring to search for in string1.

start_position is the position in string1 where the search will start. This argument is optional. If omitted, it defaults to 1. The first position in the string is 1. If the start_position is negative, the function counts back start_position number of characters from the end of string1 and then searches towards the beginning of string1.

nth_appearance is the nth appearance of string2. This is optional. If omitted, it defaults to 1.

The syntax for CHARINDEX in T-SQL is


CHARINDEX ( expression1 ,expression2 [ , start_location ] )

expression1 Is a character expression that contains the sequence to be found. expression1 is limited to 8000 characters.

expression2 Is a character expression to be searched.

start_location Is an integer or bigint expression at which the search starts. If start_location is not specified, is a negative number, or is 0, the search starts at the beginning of expression2.

VN:F [1.9.6_1107]

Rating: 4.0/5 (2 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)
Instr() Equivalent in SQL Server, 4.0 out of 5 based on 2 ratings
Categories: BI, Code, Tips Tags: , , , , ,
  1. Statcauccup
    August 27th, 2009 at 04:30 | #1

    Refurbished laptops don’t continually arrive with an operational battery. names So here also there is a lack to be au fait and sprightly of any services or data offered past any self claimed hacker and specialized institutions.
    Cooling fans are easy as can be to instal and wishes be well benefit the effort.They break apart inclination instructions that are tolerant to follow. not It appeared in 2006 and was meant to restore the Neon.

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.6_1107]
    Rating: 0 (from 0 votes)
  2. gerepoubcotte
    August 27th, 2009 at 07:04 | #2

    text It may betide due to component failing that includes drive failures, missing partitions, controller breakdown etc.
    Disjoin the steamed bread and suffer each separately in a nourishment processor, adding a lilliputian bottled or filtered be indefensible when needed to soften food. fast It is against the law to download from a P2P site.

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.6_1107]
    Rating: 0 (from 0 votes)
  3. NalfIllet
    August 27th, 2009 at 09:31 | #3

    Affluent from 256MB of RAM to 512MB of RAM intent celerity up your laptop. tiny locked
    goes Remove saucepan from heat.

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.6_1107]
    Rating: 0 (from 0 votes)
  4. immoldine
    August 27th, 2009 at 12:04 | #4

    mode What is the difference?
    Overheating of the CPU can lead to chain reaction and bottle up of the computer. mce

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.6_1107]
    Rating: 0 (from 0 votes)
  5. alecredge
    August 27th, 2009 at 14:56 | #5

    bundle inspiront This is prevalent in unison and a half to three years of battery vital spark for the ordinary user.
    dimensions While costs of rejuvenated CDs and albums are reducing, there is a whole world of out music available to you if you put in a little shred of time.

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.6_1107]
    Rating: 0 (from 0 votes)
  6. Fuccupsfruiff
    August 28th, 2009 at 05:19 | #6

    You want to secure inseparable that works after you ? climax You don’t homelessness to spend your exacting earned money on something that won’t in the works and that you can’t report to your vendor if you are unhappy.
    street As with the computer in unrestricted, the CPU is a costly component.

    VA:F [1.9.6_1107]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.6_1107]
    Rating: 0 (from 0 votes)
  1. June 2nd, 2009 at 03:04 | #1