Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

Add Descriptive Table Name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sippyuconn - 10 Jul 2008 02:58 GMT
Hi

If I have a Table NAme "StudentGrades"
Is there a way to add a More Descriptive Name to Table for Display purposes???

I may want to show a list of tables and sometimes the name are misleading
and also I may show table in Various Languages and have the Name Translated
would be needed and "StudentGrades" is not really translatable while these are
"Student Grades"
"Student Semester Grades"
etc

Thanks
Tibor Karaszi - 10 Jul 2008 07:33 GMT
Read in Books Online about "Extended Properties". Of course, the tool which you use need to be aware
of and use such extended properties.

Signature

Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

> Hi
>
[quoted text clipped - 9 lines]
>
> Thanks
Uri Dimant - 10 Jul 2008 07:34 GMT
Hi
You can add a description to the table

Here's an example script:

create table dbo.customer (
  customer_id   integer         not null identity (1, 1)
, trade_name    varchar (0255)  not null
)
go
alter table dbo.customer add
  constraint pk_customer primary key nonclustered (customer_id)
go
/* column description meta info */
execute sp_addextendedproperty N'boolean_property_01', '1', N'user', N'dbo',
N'table', N'customer', N'column', N'trade_name'
execute sp_addextendedproperty N'column_description', 'Customer trading
name', N'user', N'dbo', N'table', N'customer', N'column', N'trade_name'
go
select * from :: fn_listextendedproperty (NULL, 'user', 'dbo', 'table',
'customer', 'column', default)
go
drop table dbo.customer
go
> Hi
>
[quoted text clipped - 12 lines]
>
> Thanks
Charles Wang [MSFT] - 10 Jul 2008 09:12 GMT
Hi,
I understand that you have some tables which names having no space between
words. For translation purpose, you would like to first get a descriptive
table name with space between words.
If I have misunderstood, please let me know.

First I would like to know if all of your table names obey Pascal naming
rule. That means, each word of the combined names starts in uppercase. If
so, you may write a function or stored procedure to return a new table name
with a space between each two words. You can first judge the position of
each uppercase letter in your table name and then insert a space to the
positions, for example:
DECLARE @position int, @asciival int,@len int, @string varchar(200)
SET @position = 1
SET @string = 'StudentGradesTest'

SET @len = DATALENGTH(@string)
WHILE @position <=@len
BEGIN
  SELECT @asciival= ASCII(SUBSTRING(@string, @position, 1))
  IF (@asciival BETWEEN 65 AND 90 ) and @position<>1
  BEGIN
       SET @string = SUBSTRING(@string, 0,@position) + ' '
+SUBSTRING(@string,@position,DATALENGTH(@string)-@position+1)
        SET @len=@len+1
       SET @position=@position+1
  END
  SET @position = @position + 1
END
SELECT @string

If some of your table names do not obey Pascal naming rule, it is hard to
separate them and I recommend that you first change them according to
Pascal naming rule. Hope this helps.

If you have any other questions or concerns, please feel free to let me
know. Have a nice day!

Best regards,
Charles Wang
Microsoft Online Community Support
===========================================================
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: msdnmg@microsoft.com.
===========================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for
non-urgent issues where an initial response from the community
or a Microsoft Support Engineer within 1 business day is acceptable.
Please note that each follow up response may take approximately
2 business days as the support professional working with you may
need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
============================================================
Signature

This posting is provided "AS IS" with no warranties, and confers no rights.

=========================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.