Alan Harris-Reid
Alan Harris-Reid

Reputation: 2841

Selecting empty character column in SQLite

I want to select some rows from a SQLite table, and add an empty character column at the same time, but I get an error. The statement is SELECT firstname, SPACE(100) AS mytext FROM Customers, and the error message is "No such function: space".

I can run the same command in SQL-server without any probems, and in SQLite I can select additional numeric columns without problems (eg. SELECT firstname, 8 AS newfield ...), but not character columns.

Any help would be appreciated.

Regards, Alan

Upvotes: 0

Views: 441

Answers (1)

Samuel Neff
Samuel Neff

Reputation: 74909

Functions are not standard across database engines; some will be the same, but most are not. A complete list of standard functions is here http://www.sqlite.org/lang_corefunc.html. You can also create custom functions in C, C#, or whatever you're using.

There is no built in version of SPACE. You need to create a custom function or use a string literal.

Upvotes: 1

Related Questions