Re: simple ALTER TABLE question

From: Gail Erickson [MS] (gaile_at_online.microsoft.com)
Date: 01/25/05


Date: Tue, 25 Jan 2005 11:17:10 -0800


>Thus, a link to the page where it discusses whether
>you type brackets or braces, etc. would be helpful, in addition to the
>examples. Had I seen that today, I would not have wondered if I put
>brackets around "column" in my syntax just because it was in the
>documentation. Thanks!

Good suggestion. I'll see what I can do.

-- 
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"AFN" <newsDELETETHECAPSgroupaccount@DELETETHISyahoo.com> wrote in message 
news:2hiJd.204$e11.170@twister.socal.rr.com...
>
> "Gail Erickson [MS]" <gaile@online.microsoft.com> wrote in message
> news:%23DrQMLnAFHA.2076@TK2MSFTNGP15.phx.gbl...
>> >I absolutely hate all the garbage syntax documentation that doesn't
> contain
>> > examples.  All the syntax docs show brackets and braces and I don't 
>> > know
>> > which ones I leave out when entering text for real.
>>
>> I agree the ALTER TABLE syntax can be particularly daunting with its many
>> options.  You might find the topic "Transact-SQL Syntax  Conventions"
>> helpful in figuring out what all the brackets and braces mean.  Also,
> you'll
>> be happy to hear that we're working hard to add more examples to the
> syntax
>> topics in SQL Server 2005.  For example in the ALTER TABLE topic in SQL
>> Server 2000, there are 8 examples.  In that same topic in SQL Server 
>> 2005,
>> there are 15.
>> -- 
>> Gail Erickson [MS]
>> SQL Server Documentation Team
>> This posting is provided "AS IS" with no warranties, and confers no 
>> rights
>>
>> "AFN" <newsDELETETHECAPSgroupaccount@DELETETHISyahoo.com> wrote in 
>> message
>> news:KVdJd.9$e11.0@twister.socal.rr.com...
>> >I absolutely hate all the garbage syntax documentation that doesn't
> contain
>> > examples.  All the syntax docs show brackets and braces and I don't 
>> > know
>> > which ones I leave out when entering text for real.
>> >
>> > I just want to add a bit column to an existing table, setting it to 0 
>> > by
>> > default on existing/new records.
>> >
>> > I tried:
>> >
>> > ALTER TABLE ADD COLUMN MyNewField BIT SET DEFAULT 0
>> >
>> > but that doesn't work.  I tried multiple variations with no luck.  I
> know
>> > this is simple but it would be easier if the docs said when to uses
>> > brackets/braces, versus not, and if they gave lots of examples.
>> >
>> >
>>
>>
>
>
> It's nice to hear from someone involved in the documentation!  In this 
> case,
> the poblem was the brackets and braces and not knowing if I should type 
> them
> or not.  SQL is not particularly intuitive (I'm a .NET developer and
> comfortable with syntax issues, but there's much less logic in the SQL
> statements suggested in a single line in this thread) although I don't 
> blame
> Microsoft for that :)   Thus, a link to the page where it discusses 
> whether
> you type brackets or braces, etc. would be helpful, in addition to the
> examples.   Had I seen that today, I would not have wondered if I put
> brackets around "column" in my syntax just because it was in the
> documentation.  Thanks!
>
> 


Relevant Pages

  • Re: simple ALTER TABLE question
    ... >>I absolutely hate all the garbage syntax documentation that doesn't ... All the syntax docs show brackets and braces and I don't know ... > helpful in figuring out what all the brackets and braces mean. ...
    (microsoft.public.sqlserver.programming)
  • Re: simple ALTER TABLE question
    ... All the syntax docs show brackets and braces and I don't know ... helpful in figuring out what all the brackets and braces mean. ...
    (microsoft.public.sqlserver.programming)
  • Re: Pattern Matching problem!
    ... >> Gunnar Hjalmarsson wrote: ... > following Perl's syntax for references and data structures. ... "The arrow is optional between brackets or braces, ...
    (comp.lang.perl.misc)
  • Re: Buggy SQL Syntax for External File Path in Access 2007
    ... Parentheses around the sub-select are turned into square brackets ... AS Alias is Jet SQL's syntax for derived tables. ... One option you might consider is setting your database to use ANSI ... 92 SQL, which will mean that you can use the standard AS Alias ...
    (microsoft.public.access.modulesdaovba)
  • Re: SQL Field Names: Spaces or Naming Convention?
    ... As a C# developer I have no problem with a couple of additional text characters here and there in this particular table which contains Membership Profile properties as I consider the brackets to improve readability of the code as they immediately convey the context of the data. ... after running the code the DataTable returned by the GetSchemaTablemethod does not return Description meta data; back to square one and still have a day or two to do more research and make a decision how to manage building the UI to NURD Member Profile data dynamically. ... Because you can assign an Extended Property to any object in SQL Server, it might make sense to define a "Description" property to your columns as well as other metadata. ... We have a table which contains Membership Profile data. ...
    (microsoft.public.dotnet.framework.adonet)