| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |
|

04-30-07, 10:53
|
|
Registered User
|
|
Join Date: Oct 2006
Posts: 83
|
|
|
comment in column definition
|
|
In the below query
please tell me what the comment key word will do .
CREATE TABLE temp2 (
type21 varchar(1) default NULL COMMENT 'F: Female M:Male')
I am trying to generate the equivalent for the above query in MSSQL Server . If i know what exactly it does , then it will be easy for me to generate the similar query in SQL Server
PLZ help me out
|
|

04-30-07, 12:26
|
|
Registered User
|
|
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
|
|
All it does it allow you to place some "meaningful" information in your MySQL table. It can help (in the example you have given) someone understand what the column is for and what values it should have.
If you want the MSSQL equivalent you should ask in the MSSQL forum... 
|
|

05-02-07, 06:20
|
|
Registered User
|
|
Join Date: Oct 2006
Posts: 83
|
|
|
|
How this comment keyword affects the result set.
Quote:
CREATE TABLE temp2 (
type21 varchar(1) default NULL COMMENT 'F: Female M:Male')
|
I have exected the above query And inserted some values. Please tell me how the comment key word will make difference to the result set.
|
|

05-02-07, 06:40
|
|
King of Understatement
|
|
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
|
|
Quote:
|
Originally Posted by aschk
If you want the MSSQL equivalent you should ask in the MSSQL forum... 
|
To be fair - he did do. And my response was "what does that mean in English? This is the MSSQL forum - go ask the MySQL guys what it means in the first place then we can try to translate" 
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
|
|
|

05-02-07, 06:41
|
|
King of Understatement
|
|
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
|
|
Quote:
|
Originally Posted by aschk
All it does it allow you to place some "meaningful" information in your MySQL table. It can help (in the example you have given) someone understand what the column is for and what values it should have.
|
What is displayed to the user? 'm' or 'male'?
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
|
|
|

05-02-07, 07:06
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
Quote:
|
Originally Posted by pootle flump
What is displayed to the user? 'm' or 'male'?
|
it'd be pretty difficult to pull 'male' out of a VARCHAR(1) column

|
|

05-02-07, 07:12
|
|
Registered User
|
|
Join Date: Oct 2006
Posts: 83
|
|
consider it as varchar(24)
|
|

05-02-07, 07:35
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
wouldn't make any difference
the comment is just a comment, it has absolutely no effect on anything
|
|

05-02-07, 08:06
|
|
Registered User
|
|
Join Date: Oct 2006
Posts: 83
|
|
is that comment will be displayed in the table .
I mean if we create a table with a comment defined , and after inserting the values to it, Then if we display the table(Select * from temp2) ,will that comment string appear
|
|

05-02-07, 08:11
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
Quote:
|
Originally Posted by krReddy
... will that comment string appear
|
absolutely not
|
|

05-02-07, 08:12
|
|
King of Understatement
|
|
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
|
|
Quote:
|
Originally Posted by r937
it'd be pretty difficult to pull 'male' out of a VARCHAR(1) column

|
Note I said what is displayed  .
Anyway - Kr - your answer for converting to SQL is you can create a description for the column as demonstrated in the other thread. This will have no affect on the data (constraints etc). I presume the same is true here.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
|
|
|

05-02-07, 10:33
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 440
|
|
krReddy, have you bothered to make a test table and find out?
|
|

05-02-07, 12:56
|
|
Registered User
|
|
Join Date: Oct 2006
Posts: 83
|
|
I have tried it, but the comment is nowhere displayed in the table .
But when i execute 'SHOW FULL COLUMNS FROM TEMP2' ,its being present in comment field.
|
|

05-02-07, 15:25
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 440
|
|
okay so exactly what are you trying to do? a comment is never displayed in your table unless you explicitly do so either with the show full columns, or show create table or whatever. at no other time do you see a comment for a field.
do you really want a default value for a column or something like that or are you merely trying to understand how comments work?
in your case under a column called SEX for instance, a comment may not be necessary if you only use M or F to represent, but what if you also included T for transgendered for instance. then a comment would make sense because if you were to go back to the table at some distant time, or turn the application over to someone else, the comment would make it clear exactly what the reason for T being in that column was.
|
|

05-02-07, 16:26
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
Quote:
|
Originally Posted by guelphdad
in your case under a column called SEX for instance, a comment may not be necessary if you only use M or F to represent, but what if you also included T for transgendered for instance. then a comment would make sense because if you were to go back to the table at some distant time, or turn the application over to someone else, the comment would make it clear exactly what the reason for T being in that column was.
|
i would use a foreign key to a proper domain table instead
the data is the documentation
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|