Re: simple ALTER TABLE question

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


Date: Mon, 24 Jan 2005 16:14:10 -0800


>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.
>
> 


Relevant Pages

  • Re: simple ALTER TABLE question
    ... SQL Server Documentation Team ... All the syntax docs show brackets and braces and I don't ...
    (microsoft.public.sqlserver.programming)
  • 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: 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: Square brackets?
    ... doesn't even see parentheses, but looks solely at the indentation. ... But by this reasoning the brackets are just needless syntactic ... as to whether that syntax even makes things any easier to read. ... The vast majority of beginners are ...
    (comp.lang.scheme)
  • Re: DCount Criteria - Easy Question!
    ... your syntax is more correct for use in a VBA module (though not quite ... the above syntax assumes the ClientID is a Number data type. ... brackets around rather than Forms! ...
    (microsoft.public.access.forms)