Plesae tell me the MSSQL Server equivalent of the below MySQL query .
create table temp2(a varchar(23) comment 'male m');
What is the use of specifying a keyword 'comment' in the column definition. Will it make any differenceThat create table statement does not work in SQL Server. What RDBMS are you using?|||Sorry , the above SQL Query is in MySQL Syntax . Could you please tell me the equivalent in MSSQL Server.|||Is comment setting a default?|||Actually it looks more like SPSS value labels or the like. If so - no- you need to set up another table and establish a foreign key.|||I'm guessing that you are trying to add a comment to your column to indicate what it is for. Depending on your version of SQL Server, you will have to use a separate syntax:
SQL 2000
sp_addextendedproperty 'Caption', 'US Phone Number',
'user', dbo, 'table', TestExProp, 'column', USPhoneNmbr
SQL 2005:
EXEC sys.sp_addextendedproperty
@.name = N'MS_DescriptionExample',
@.value = N'Minimum inventory quantity.',
@.level0type = N'SCHEMA', @.level0name = Production,
@.level1type = N'TABLE', @.level1name = Product,
@.level2type = N'COLUMN', @.level2name = SafetyStockLevel;
GO
Regards,
hmscott|||I think the 2000 syntax works on 2005 as well actually, for backwards compatibility.|||I think the 2000 syntax works on 2005 as well actually, for backwards compatibility.
prolly, but no sense in making it easy for him...
:D
hmscott|||in that case you should have given him the 2007 syntax. ;)|||in that case you should have given him the 2007 syntax. ;)
That's the new "virtual" syntax. You just think about it and it appears...
:D
hmscott|||FYI:
http://www.dbforums.com/showthread.php?p=6270444#post6270444
Thanks for trying to find out krReddy|||I am creating a table in SQL Server using the below query.
CREATE TABLE temp(
type21 varchar(1) default NULL /*where the COMMENT will be saved'*/)
In the above query there is a comment line enclosed in /* and */ .
This query is executable .
Please tell me where will this comment line be saved in SQL Server database .
I have checked this in SYSCOMMENTS but i didn't found .
If it is saved some where in the database , Plz tell me the query to fetch that comment
Thanks|||Syscomments is something else entirly. You know that the stuff /* here */ is commented out (a different sort of meaning for comment) and as such does not get executed. It is not stored anywhere. As far as SQL Server is concerned it does not exist - it is for the coders use only.|||If it is saved some where in the database ...it isn't :)|||it isn't :)Sigh - if only I could be so concise.
Why use twenty words when two\ three will do.
Indeed - why write all that at all?|||sorry, pootsie, did not mean to trample your fine post
i was busy merging this guy's threads and so i missed your reply|||Nowt trampled & no worries.
No comments:
Post a Comment