March 6, 2014 at 7:14 am
Hi
I need to write code so that I can get the number of chars in my field "heu_postmeta".
I wrote this...
SELECT LEN(`meta_value`) FROM `heu_postmeta`
Getting error "LEN" does not exist
Any help is appreciated.
March 6, 2014 at 7:16 am
Try the following:
SELECT LEN(meta_value) FROM heu_postmeta
I assume meta_value is a column and heu_postmeta is a table?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 6, 2014 at 7:20 am
Hi
I just ran the query and got the same error LEN does not exist
SELECT LEN(meta_value) FROM heu_postmeta
meta_value is the field name
heu_postmeta is the table
March 6, 2014 at 7:24 am
What database platform are you using? You sure it's SQL Server?
---------------------------------------------------------
It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens[/url]
Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
March 6, 2014 at 7:24 am
You're using SQL Server, right?
I'm pretty sure it exists:
Is that your exact query? Maybe there is a syntax error somewhere (such as a missing bracket).
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 10, 2014 at 4:12 am
kaththecoder (3/6/2014)
HiI just ran the query and got the same error LEN does not exist
SELECT LEN(meta_value) FROM heu_postmeta
meta_value is the field name
heu_postmeta is the table
LEN is a valid Sql Server Function and has been in the product for as long as I can remember.
Copy and paste the exact error you are receiving and of course make sure you are running it against a Sql Server Instance.
March 10, 2014 at 5:32 am
kaththecoder (3/6/2014)
I just ran the query and got the same error LEN does not existSELECT LEN(meta_value) FROM heu_postmeta
Like CK2 said, LEN is a function that's been there forever. I would make sure your query is running in the database that contains your table, then verify the name of your table and column. The weird thing is the error message. If the table didn't exist, the table would be called out as the source of the error, not the LEN function. Like Koen and Abu Dina asked, are you using SQL Server?
The function is documented at http://technet.microsoft.com/en-us/library/ms190329%28v=sql.100%29.aspx.
March 18, 2014 at 6:36 am
SELECT LEN(CAST(meta_value AS NVARCHAR)) FROM heu_postmeta
I ran into an issue the other day where a field like meta_value was not a varchar/nvarchar/etc, and all I had to do was cast it make my modifications and reinsert it back in.
March 24, 2014 at 12:23 am
kaththecoder (3/6/2014)
HiI need to write code so that I can get the number of chars in my field "heu_postmeta".
I wrote this...
SELECT LEN(`meta_value`) FROM `heu_postmeta`
Getting error "LEN" does not exist
Any help is appreciated.
Code smells like MySQL. Are you using openquery?
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply