By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,760 Members | 1,585 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,760 IT Pros & Developers. It's quick & easy.

Val() is not a recognized function name?

P: 13

I am executing, update query as
Expand|Select|Wrap|Line Numbers
  1. Update taans set pbno='OLD' & pbno where  val(right(itemcode,5))<2774; 
, while executing it gives error as "Val() is not a recognized function name" how can over come this error? Is any predefined method available?
my item code is like 'V00121".

Thanks in Advance,
Apr 19 '12 #1
Share this Question
Share on Google+
3 Replies

Expert 2.5K+
P: 2,878
Use CAST or CONVERT functions instead.

Happy Coding!!!

~~ CK
Apr 19 '12 #2

P: 13
CAST or CONVERT these two not working.
when using cast it gives error as "Server: Msg 403, Level 16, State 1, Line 1
Invalid operator for data type. Operator equals boolean AND, type equals nvarchar."
Thanks in Advance,
Apr 20 '12 #3

Expert Mod 10K+
P: 12,383
That's because the function takes an additional parameter stating the data type you wish to CAST or CONVERT to. Also, why are you using the & operator? It's a boolean operator. SQL is not VB, that's not a concatenation operator. The concatentaion operator in SQL is +
Apr 20 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.