Feature request: DF_FIELD_SQL_COLUMN_NAME
DF_FILE_SQL_TABLE_NAME is a useful attribute that makes it possible to retrieve the name of a table as defined on the SQL server. [U]Even if national characters have been used[/U]. This is cool when you want to generate SQL script for executing in an SQL call.
However, the same feature is needed for table column names and for the same reason. A DF_FIELD_SQL_COLUMN_NAME attribute.
-Sture
Re: Feature request: DF_FIELD_SQL_COLUMN_NAME
[URL]https://docs.dataaccess.com/dataflexhelp/#t=mergedProjects%2FLanguageReference%2FDF_FIELD_NAME_Attribute.htm[/URL]
df_field_name does that!
Re: Feature request: DF_FILE_SQL_TABLE_NAME! DF_FIELD_SQL_COLUMN_NAME?
Unfortunately no.
This field name [Mistænkt måltid] (yes, there's a space in there) will be represented as "Mist_nkt_m_ltid" by DF and this is what is returned by DF_FIELD_NAME.
And if I want to use it for generating a select statement I need the original name.
-Sture
Re: Feature request: DF_FILE_SQL_TABLE_NAME! DF_FIELD_SQL_COLUMN_NAME?
holly crap! So we have an issue here..
This attribute is exactly what is used by DD helper functions to create the SQLFilter expressions
[code]
Function SQLStrFieldName Integer iField Returns String
String sField
Integer iFile
Get Main_File to iFile
Get_Attribute [B]DF_FIELD_NAME[/B] of iFile iField to sField
Function_Return ('"' + sField + '"' )
End_Function
[/code]
If it does not returns the real column name defined in the table, we have a bug here!
Re: Feature request: DF_FILE_SQL_TABLE_NAME! DF_FIELD_SQL_COLUMN_NAME?
Not necessarily a bug, I'd say.
But a DF_FIELD_SQL_COLUMN_NAME attribute is needed.
The DF_FILE_SQL_TABLE_NAME is already there.
Re: Feature request: DF_FILE_SQL_TABLE_NAME! DF_FIELD_SQL_COLUMN_NAME?
I consider it as a bug, because dd uses this attribute to build the SQL Filter expressions. try using SQLFilter using DD constructor functions with this column you have, and you will receive an SQLSTATE saying the column is unknown.
I always thought this attribute should always return the back-end name. not the name we have defined in the .fd file. As you know they don't need to match at all.
Re: Feature request: DF_FILE_SQL_TABLE_NAME! DF_FIELD_SQL_COLUMN_NAME?
Yes, of course that is a bug. I was thinking it wasn't because I've used that attribute to generate DF source code and then it is the correct value.
So you are now in 100% support of requesting a DF_FIELD_SQL_COLUMN_NAME attribute :-)
(I wonder if you can do a select that returns the column names for table xxxx)
-Sture
Re: Feature request: DF_FILE_SQL_TABLE_NAME! DF_FIELD_SQL_COLUMN_NAME?
[QUOTE][COLOR=#333333]So you are now in 100% support of requesting a DF_FIELD_SQL_COLUMN_NAME attribute :-)[/COLOR][/QUOTE]
Yes, and the dd helper functions get changed to use the new attribute as well.
[QUOTE][COLOR=#333333](I wonder if you can do a select that returns the column names for table xxxx)[/COLOR][/QUOTE]
I know how to do that in db2...
this seems to do it for MsSQL
[URL="https://www.tutorialgateway.org/get-column-names-from-table-in-sql/"]Get Column Names From Table in SQL Server (tutorialgateway.org)[/URL]
Re: Feature request: DF_FILE_SQL_TABLE_NAME! DF_FIELD_SQL_COLUMN_NAME?
Re: Feature request: DF_FILE_SQL_TABLE_NAME! DF_FIELD_SQL_COLUMN_NAME?
in the meantime you can query the sys schema to get the column names