Re: Incorrect syntax near the keyword 'Close'

From: Wayne Snyder (wayne.nospam.snyder_at_mariner-usa.com)
Date: 09/26/04


Date: Sun, 26 Sep 2004 09:31:42 -0400

If you use keywords( documented in Books on line) as the names of ANY
objects in SQL you must brace them if

create table [OPEN]
([Key] int not null)

It is a good idea NOT to use reserve words if you can avoid it, because
you'll be forgetting to use the brackets and re-doing code over and
over(kind of annoying.)

-- 
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"fniles" <fiefieniles@yahoo.com> wrote in message
news:2067fd92.0409251452.60e065d7@posting.google.com...
> When I created a SQL Server database by running a script, it gave me a
> few errors like the following:
>
> Incorrect syntax near the keyword 'KEY'.
> Incorrect syntax near the keyword 'Close'.
> Incorrect syntax near the keyword 'Open'.
>
> Is this because those words (Key, CLose and Open) are reserved words ?
>
> Thanks.


Relevant Pages

  • Please Help with Transaction + Alter Procedure statement
    ... I am struggling with the following SQL. ... Incorrect syntax near the keyword 'PROCEDURE'. ... Must declare the variable '@mySomething'. ...
    (microsoft.public.sqlserver)
  • strange errors in execute sql task
    ... while executing "execute sql" tasks. ... Incorrect syntax near "1" ... uninstalling & installing sql server didn't help. ...
    (microsoft.public.sqlserver.dts)
  • strange errors with dts and sql
    ... while executing "execute sql" tasks. ... Incorrect syntax near "1" ... uninstalling & installing sql server didn't help. ...
    (microsoft.public.sqlserver.server)
  • Re: Error when calling the OleDbDataAdapter.Fill() method
    ... Have you tried copying and pasting the query into an Access query ... it is caused by using a keyword as a fieldname in my database. ... Here is the SQL statement I am executing (I am using Microsoft Access as my ... SELECT headline,url,summary,updated FROM worldnews EXCEPT (SELECT ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: SQL to Linq - Left, Right and Inner Joins
    ... At least, for me, that helps to see the process as being a double translation, and to STOP thinking in SQL sets, while using LINQ, but to then think in terms of for-each sequences. ... The second 'table' is introduced with the keyword join rather than with the keyword from, as previously, the on keyword introduces the relation, always an equality. ... There is no LINQ-Right outer join, ...
    (microsoft.public.dotnet.languages.csharp)