cancel
Showing results for 
Search instead for 
Did you mean: 

Question about SQL syntax

Former Member
0 Kudos
54

Hi,

I am trying to create a very simple SQL Expression, but can't seem to get the syntax to be valid. The database connection is to a SQL Server database. If I were to create the query in SQL Server Management Studio, it would be something like

select LastName from People

However, every variant I can think of, based on various examples in books and on-line postings, fails syntax check. These include, among many others:

select "People"."LastName"

from "People"

select "People"."LastName"

from "PiapDB_ss5"."dbo"."People"

I have also tried single quotes instead of double quotes. I keep getting the same error:

Database Connector Error: '42000:[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid syntax near the keyword 'select'. [Database vendor code: 156].

Any suggestions as to the proper syntax?

Thanks.

Dan

Accepted Solutions (1)

Accepted Solutions (1)

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

an sql expression field is meant to return one value, not records. therefore using a "select * from ..." statement won't work. if you know the select statement will return one value only (e.g. select name from table where id=123), you can surround the statement with parenthesis, that should work.

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

in sql expression fields you can also use sql functions such (e.g. LOWER, LTRIM, etc)

Answers (0)