|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi --
I am looking to migrate an old application built with ASP and running on SQL Server 2000 to a RIA type app possibly using Java and SQL Server 2008. I have been reading about SQL MetaData and I am curious to know if the information obtained via the getColumnLabel() function in Java can be stored as metadata in SQL Server. From what I have read so far this column label data comes when you do a SELECT FIELD as OTHERNAME, the column label would be "OTHERNAME" What I would ideally like to do is store a text string that would be used as a caption for a field. For example, the field FIRSTNAME would have a column label of "First Name" Is this possible in SQL Server 2008? Thanks Rich |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Rich,
I don't believe there is any way to put a default override for column names, because how would you then ever get the real name from a SELECT query. However you can create a view to have alternate column names. CREATE VIEW vSpelledOut AS SELECT FIRSTNAME AS [First Name], ... FROM MyTable Note that you need to use [] (or some other delimeter based on server settings) to delimit identifiers with spaces or other special characters. -- Thank you, Daniel Jameson SQL Server DBA Children's Oncology Group www.childrensoncologygroup.org "Richard Morey" <rwmorey71@hotmail.com> wrote in message news:eXCTsauCJHA.1224@TK2MSFTNGP02.phx.gbl... > Hi -- > > I am looking to migrate an old application built with ASP and running on > SQL Server 2000 to a RIA type app possibly using Java and SQL Server 2008. > I have been reading about SQL MetaData and I am curious to know if the > information obtained via the getColumnLabel() function in Java can be > stored as metadata in SQL Server. > > From what I have read so far this column label data comes when you do a > SELECT FIELD as OTHERNAME, the column label would be "OTHERNAME" What I > would ideally like to do is store a text string that would be used as a > caption for a field. For example, the field FIRSTNAME would have a column > label of "First Name" Is this possible in SQL Server 2008? > > Thanks > > Rich > > |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Hi --
Thanks for the feedback. I don't want to override the column names, but it appears to me that Java supports a getColumnLabel() and getColumnName() which are the same unless a select query uses an AS statement. I was hoping I could associate a column label parameter with the column name. I appreciate your idea of the view, however, I would like to have the column label parameter available whenever I did a select query and not have to do a seperate query to get the labels. Thanks, Rich "Daniel Jameson" <no_danjam_spam@cyberdude.com> wrote in message news:%23KRP0axCJHA.4576@TK2MSFTNGP05.phx.gbl... > Rich, > > I don't believe there is any way to put a default override for column > names, because how would you then ever get the real name from a SELECT > query. However you can create a view to have alternate column names. > > CREATE VIEW vSpelledOut AS > SELECT FIRSTNAME AS [First Name], ... > FROM MyTable > > Note that you need to use [] (or some other delimeter based on server > settings) to delimit identifiers with spaces or other special characters. > > -- > Thank you, > > Daniel Jameson > SQL Server DBA > Children's Oncology Group > www.childrensoncologygroup.org > > > "Richard Morey" <rwmorey71@hotmail.com> wrote in message > news:eXCTsauCJHA.1224@TK2MSFTNGP02.phx.gbl... >> Hi -- >> >> I am looking to migrate an old application built with ASP and running on >> SQL Server 2000 to a RIA type app possibly using Java and SQL Server >> 2008. I have been reading about SQL MetaData and I am curious to know if >> the information obtained via the getColumnLabel() function in Java can be >> stored as metadata in SQL Server. >> >> From what I have read so far this column label data comes when you do a >> SELECT FIELD as OTHERNAME, the column label would be "OTHERNAME" What I >> would ideally like to do is store a text string that would be used as a >> caption for a field. For example, the field FIRSTNAME would have a column >> label of "First Name" Is this possible in SQL Server 2008? >> >> Thanks >> >> Rich >> >> > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
I am not sure I follow you here. If you want a different name or label for a
column the appropriate and preferred method is to use an alias as Daniel suggested in the query itself of using a view. I don't see how you intend to get a label if the column does not use an alias without making two calls. I don't know of the getColumnLabel() function in Java but it appears to require an alias to work. So you either need a predefined object that has the labels you require or you need to make additional calls. You can use the SQL Server extended property to assign a description to pretty much any object but you cannot retrieve this information via the select. Again that is what alias's are for. But you may want to check out the extended properties in BooksOnLine to see if they will get you closer to your goal but I think what you are asking for is not feasible. -- Andrew J. Kelly SQL MVP Solid Quality Mentors "Richard Morey" <rwmorey71@hotmail.com> wrote in message news:ODhDplxCJHA.3432@TK2MSFTNGP05.phx.gbl... > Hi -- > > Thanks for the feedback. I don't want to override the column names, but it > appears to me that Java supports a getColumnLabel() and getColumnName() > which are the same unless a select query uses an AS statement. I was > hoping I could associate a column label parameter with the column name. > > I appreciate your idea of the view, however, I would like to have the > column label parameter available whenever I did a select query and not > have to do a seperate query to get the labels. > > Thanks, > > Rich > > "Daniel Jameson" <no_danjam_spam@cyberdude.com> wrote in message > news:%23KRP0axCJHA.4576@TK2MSFTNGP05.phx.gbl... >> Rich, >> >> I don't believe there is any way to put a default override for column >> names, because how would you then ever get the real name from a SELECT >> query. However you can create a view to have alternate column names. >> >> CREATE VIEW vSpelledOut AS >> SELECT FIRSTNAME AS [First Name], ... >> FROM MyTable >> >> Note that you need to use [] (or some other delimeter based on server >> settings) to delimit identifiers with spaces or other special characters. >> >> -- >> Thank you, >> >> Daniel Jameson >> SQL Server DBA >> Children's Oncology Group >> www.childrensoncologygroup.org >> >> >> "Richard Morey" <rwmorey71@hotmail.com> wrote in message >> news:eXCTsauCJHA.1224@TK2MSFTNGP02.phx.gbl... >>> Hi -- >>> >>> I am looking to migrate an old application built with ASP and running on >>> SQL Server 2000 to a RIA type app possibly using Java and SQL Server >>> 2008. I have been reading about SQL MetaData and I am curious to know if >>> the information obtained via the getColumnLabel() function in Java can >>> be stored as metadata in SQL Server. >>> >>> From what I have read so far this column label data comes when you do a >>> SELECT FIELD as OTHERNAME, the column label would be "OTHERNAME" What I >>> would ideally like to do is store a text string that would be used as a >>> caption for a field. For example, the field FIRSTNAME would have a >>> column label of "First Name" Is this possible in SQL Server 2008? >>> >>> Thanks >>> >>> Rich >>> >>> >> >> > > |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Hi --
I was hoping to store the alias so that if, for example, I did a SELECT * FROM TABLE the alias would be available via the getColumnLabel() while the field name would be available via getColumnName(). I think you are right in that what I want to do is not feasible so I will look into creating a view or storing the information in some other way. Thanks for your . Rich "Andrew J. Kelly" <sqlmvpnooospam@shadhawk.com> wrote in message news:emwozM3CJHA.3352@TK2MSFTNGP05.phx.gbl... >I am not sure I follow you here. If you want a different name or label for >a column the appropriate and preferred method is to use an alias as Daniel >suggested in the query itself of using a view. I don't see how you intend >to get a label if the column does not use an alias without making two >calls. I don't know of the getColumnLabel() function in Java but it appears >to require an alias to work. So you either need a predefined object that >has the labels you require or you need to make additional calls. You can >use the SQL Server extended property to assign a description to pretty much >any object but you cannot retrieve this information via the select. Again >that is what alias's are for. But you may want to check out the extended >properties in BooksOnLine to see if they will get you closer to your goal >but I think what you are asking for is not feasible. > > -- > Andrew J. Kelly SQL MVP > Solid Quality Mentors > > > "Richard Morey" <rwmorey71@hotmail.com> wrote in message > news:ODhDplxCJHA.3432@TK2MSFTNGP05.phx.gbl... >> Hi -- >> >> Thanks for the feedback. I don't want to override the column names, but >> it appears to me that Java supports a getColumnLabel() and >> getColumnName() which are the same unless a select query uses an AS >> statement. I was hoping I could associate a column label parameter with >> the column name. >> >> I appreciate your idea of the view, however, I would like to have the >> column label parameter available whenever I did a select query and not >> have to do a seperate query to get the labels. >> >> Thanks, >> >> Rich >> >> "Daniel Jameson" <no_danjam_spam@cyberdude.com> wrote in message >> news:%23KRP0axCJHA.4576@TK2MSFTNGP05.phx.gbl... >>> Rich, >>> >>> I don't believe there is any way to put a default override for column >>> names, because how would you then ever get the real name from a SELECT >>> query. However you can create a view to have alternate column names. >>> >>> CREATE VIEW vSpelledOut AS >>> SELECT FIRSTNAME AS [First Name], ... >>> FROM MyTable >>> >>> Note that you need to use [] (or some other delimeter based on server >>> settings) to delimit identifiers with spaces or other special >>> characters. >>> >>> -- >>> Thank you, >>> >>> Daniel Jameson >>> SQL Server DBA >>> Children's Oncology Group >>> www.childrensoncologygroup.org >>> >>> >>> "Richard Morey" <rwmorey71@hotmail.com> wrote in message >>> news:eXCTsauCJHA.1224@TK2MSFTNGP02.phx.gbl... >>>> Hi -- >>>> >>>> I am looking to migrate an old application built with ASP and running >>>> on SQL Server 2000 to a RIA type app possibly using Java and SQL Server >>>> 2008. I have been reading about SQL MetaData and I am curious to know >>>> if the information obtained via the getColumnLabel() function in Java >>>> can be stored as metadata in SQL Server. >>>> >>>> From what I have read so far this column label data comes when you do a >>>> SELECT FIELD as OTHERNAME, the column label would be "OTHERNAME" What I >>>> would ideally like to do is store a text string that would be used as a >>>> caption for a field. For example, the field FIRSTNAME would have a >>>> column label of "First Name" Is this possible in SQL Server 2008? >>>> >>>> Thanks >>>> >>>> Rich >>>> >>>> >>> >>> >> >> > |
|
![]() |
| Outils de la discussion | |
|
|