Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error with find and charindex functions

Author  Topic 

Tomb
Starting Member

10 Posts

Posted - 2012-02-23 : 17:31:32
I have messy place name data in a column called place_name and I only want to extract Starbucks. In my where statement I'm including:

find(upper(place_name),'STARBUCK')>0

and getting the following error in DBVisualizer (connecting to Vertica):

[Error Code: 0, SQL State: 42883] ERROR: function find(varchar, "unknown") does not exist, or permission is denied for find(varchar, "unknown")

I get the same error trying to apply the same constraint using the charindex function instead.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-23 : 17:58:21
i'm sure this is not t-sql
Which RDBMS you're working with?
This is a MS SQL SERver forum so you may be better off using relevent forums if you're not using SQL Server

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Tomb
Starting Member

10 Posts

Posted - 2012-02-23 : 18:09:24
I'm using Vertica on the back end but most of the syntax is identical and this is the best forum I've found for it.

charindex is t-sql I believe.
Go to Top of Page

Tomb
Starting Member

10 Posts

Posted - 2012-02-23 : 18:17:17
Figured it out - had to cast 'STARBUCK' as varchar
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-23 : 18:23:12
quote:
Originally posted by Tomb

I'm using Vertica on the back end but most of the syntax is identical and this is the best forum I've found for it.

charindex is t-sql I believe.


yep its charindex or patindex depending on whether you want to look for a character or pattern

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -