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
 Instr for numbers

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2009-06-16 : 09:39:58
What is the equivalent for numbers ? In this ?skill will be a number and ANS_QId is a numeric field in a sql table. It is to be used in a crystal report selection formula

instr({?skill},{vweShowAnswers.ANS_QId}) > 0

nr
SQLTeam MVY

12543 Posts

Posted - 2009-06-16 : 10:14:03
You can convert all data to character in the statement.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2009-06-16 : 10:24:07
Could you help me witrh the syntax for that please. Is it something like this ?

instr(char({?skill}),char({vweShowAnswers.ANS_QId})) > 0
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-16 : 12:26:52
instr is not in sql. you need to use charindex

CHARINDEX(CONVERT(char(1), skill),CONVERT(varchar(15),ANS_QId))>0
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2009-06-17 : 08:02:39
Thank you visakh I will try that now
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-17 : 08:08:31
WHERE CAST(ANS_QId AS VARCHAR(12)) LIKE '%' + @skill + '%'


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2009-06-17 : 09:19:18
I was approaching it completely wrong. This is what I needed

{vweShowAnswers.ANS_QId} = ToNumber ({?Skill})
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-17 : 10:01:47
quote:
Originally posted by Pinto

I was approaching it completely wrong. This is what I needed

{vweShowAnswers.ANS_QId} = ToNumber ({?Skill})


werent you using SQL Server?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-17 : 10:07:40
quote:
Originally posted by Pinto

It is to be used in a crystal report selection formula



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-17 : 10:09:41
quote:
Originally posted by Peso

quote:
Originally posted by Pinto

It is to be used in a crystal report selection formula



E 12°55'05.63"
N 56°04'39.26"



ah..i've turned blind
Go to Top of Page
   

- Advertisement -