locked
Access Table Properties in SQL RRS feed

  • Question

  • Thanks for taking the time to read my question.

    In an Access table there is a spot where you can set the "Caption" of a field.

    I access it like this: rst.Fields(x).Properties("Caption")

    I'm wondering if there is a place in SQL where I can store something similar and if so where, and how it can be accessed.

    p.s. not sure if this is the best forum, but am not sure where else to start.

    Thanks,
    Brad

    Thursday, October 12, 2017 8:09 PM

Answers

  • Hi,

    I actually just stumbled across an answer. In a SQL DATABASE you can use Extended Properties and create "Caption" and then populate the value for the field. This way you can store extra info for the field and pull it up when needed.

    For example, when creating a form, Access uses the Caption value to create the label for the form field.

    Thanks

    Brad


    • Edited by mbrad Thursday, October 12, 2017 9:03 PM added Database for clarity
    • Proposed as answer by Chenchen Li Friday, October 13, 2017 6:00 AM
    • Marked as answer by mbrad Friday, October 13, 2017 2:13 PM
    Thursday, October 12, 2017 9:01 PM

All replies

  • Hi Brad,

    What do you mean by "in SQL?" If you're talking about queries, then you can use an ALIAS for each field. For example:

    SELECT FieldName AS AliasNameHere FROM TableName

    Hope it helps...

    Thursday, October 12, 2017 8:43 PM
  • Hi,

    Sorry I was not clear enough.

    I am referring to the Caption property of a field in a table in Access. Is there an equivalent in SQL?

    Caption

    Thanks,
    Brad

    Thursday, October 12, 2017 8:46 PM
  • Hi Brad,

    If I understand your question correctly, the equivalent in SQL is as I said earlier: use an ALIAS.

    Otherwise, if you're referring to the query designer, there is also a Caption property there.

    Thursday, October 12, 2017 8:58 PM
  • Hi Brad,

    My confusion stems from your use of the term "SQL." To me SQL means Structured Query Language, which is the language you use to create queries and such. For example, like I said earlier, the following is a SQL statement:

    SELECT FieldName AS AliasName FROM TableName

    It's possible, to you, "SQL" means SQL Server. If so, I guess your question actually means, is there an equivalent code in T-SQL as what you have using VBA to modify the Caption property of a table's field.

    Is that what you mean? 

    Thursday, October 12, 2017 9:01 PM
  • Hi,

    I actually just stumbled across an answer. In a SQL DATABASE you can use Extended Properties and create "Caption" and then populate the value for the field. This way you can store extra info for the field and pull it up when needed.

    For example, when creating a form, Access uses the Caption value to create the label for the form field.

    Thanks

    Brad


    • Edited by mbrad Thursday, October 12, 2017 9:03 PM added Database for clarity
    • Proposed as answer by Chenchen Li Friday, October 13, 2017 6:00 AM
    • Marked as answer by mbrad Friday, October 13, 2017 2:13 PM
    Thursday, October 12, 2017 9:01 PM
  • AH! Sorry! You're right, that is super vague.

    What I'm referring to is a SQL database... key word being database. Apparently it's been a very long day. So sorry for the confusion.

    Brad

    Thursday, October 12, 2017 9:03 PM
  • Hi Brad,

    No worries. Glad to hear you found a working solution. It threw me off a little bit because SQL and SQL Databases are not always the same thing.

    Good luck!

    Thursday, October 12, 2017 9:08 PM
  • Hello Brad,

    I suggest you mark your solution as answer to close this thread.

    Besides, if you have any issues related to SQL Sever, you could post on the following forums:

    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, October 13, 2017 6:02 AM