[freetds] odbc problem obtaining column name

James K. Lowden jklowden at schemamania.org
Mon Apr 19 10:26:02 EDT 2004


On Mon, 19 Apr 2004, Roger Reynolds <rogerr at softix.com> wrote:
> 
> From an ODBC application, given a query like this
>    "select user"
> where the column selected is not a real column, but
> a "psuedo column" or whatever the right term is...
...
> If I modify the query to 
>    "select user as user"
> 
> then I get the column name defined as I expect.

I'd need to know precisely what your "psuedo column" is to give you a
precise answer, because "select user" isn't parseable T-SQL.  

Tables and views have columns with names.  Queries and stored procedures
can derive columns that have no names, as with functions.  

If you say:

	select @@servername
	select user_name()
	select count(*) from systypes
	select 'horseradish'

in each case you'll get a column without a name.  

Whether or not a column has a name, you can create your own by tacking on
"as myname" after the element.  

HTH.  

--jkl



More information about the FreeTDS mailing list