Subscribe to this thread
Home - Cutting Edge / All posts - StringLength function
dyalsjas59 post(s)
#04-Feb-18 14:29

Running Manifold 9.0.165.0

Working through Chris Fehily SQL 2015 edition

Example data tables are loaded into an enterprise datastore running on SQL Server 2016

I used the query builder to build the following query:

SELECT

[au_fname],

StringLength([au_fname]) AS "Len"

FROM [dbo.authors];

When running the query I receive the following message

'StringLength' is not a recognized built-in function name.

I'm sure I've missed something simple.

Dimitri


4,596 post(s)
#04-Feb-18 14:43

Sounds like you are executing on SQL Server 2016, not within Manifold. SQL Server doesn't have a StringLength function... I believe they call their function LEN, but I could be wrong.

To learn about switching between Manifold and the native query engine for the data source you are using, see the Example: Switching between Manifold and Native Query Engines topic.

I'd advise downloading the books.map project from the Product Downloads page and running all the examples entirely within Manifold. When you are learning the system there's no need to add extra complications like learning when you are executing a query on SQL Server 2016 or within Manifold.

dyalsjas59 post(s)
#04-Feb-18 15:35

Thank you,

Taking SQL Server out of the mix solved the problem.

I'll also get better with query builder while tweaking the text listings in the book.map download to work in Manifold.

Here's the relevant text listing from books.map:

SELECT au_fname, LEN(au_fname) AS ["Len"]

FROM authors;

Here's the updated text listing that works as a query in Manifold:

SELECT au_fname,

StringLength([au_fname]) AS ["Len"]

FROM authors;

dyalsjas59 post(s)
#04-Feb-18 15:55

To be clear,

Only a few text listings need tweaking to work in Manifold.

Most work as is.

Dimitri


4,596 post(s)
#04-Feb-18 16:27

You could also just write

StringLength([au_fname]) AS [Len]

...with no need for the double quotes around Len.

dyalsjas59 post(s)
#04-Feb-18 21:09

Yes,

I've begun to realize some of the differences between Manifold and SQL Server.

I'll probably go back and redo using Manifold and SQL Server later.

Right now, I'm trying to make the text listings look similar to the layout from the Fehily SQL 2015 text.

It seems more readable and cross-referencing back later will be easier.

tjhb

7,778 post(s)
#04-Feb-18 22:36

Good on you for that . An investment in finding a format and coding style that makes sense for you will really pay off in the long term. Fehily's style (and consistency) is a great model. You might want to adapt or extend it over time, to make specialist Manifold SQL constructs and idioms work for you.

My aim has been to get the code in my head to match the code on the page or the screen, and vice versa (a process going to and fro). That makes it easier to master a range of patterns, and imagine new ones--to learn to think in SQL. (Among other things that's a big advantage when trying so solve a coding problem on a long walk, while taking a shower, pruning the camellias, or in your sleep. Which are often much better places to do that than in front of a screen.)

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.