SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL query syntax error

    Could someone please tell me what is wrong with this query?

    I get this error:
    Msg 102, Level 15, State 1, Line 3
    Incorrect syntax near '('.

    thanks


    ALTER TABLE [products]
    ADD ([pcProd_cmTabbedContent1] [nvarchar(MAX)] NULL,
    [pcProd_cmTabbedContent2] [nvarchar(MAX)] NULL,
    [pcProd_cmTabbedContent3] [nvarchar(MAX)] NULL,
    [pcProd_cmTabbedContent4] [nvarchar(MAX)] NULL,
    [pcProd_cmTabbedContent5] [nvarchar(MAX)] NULL,
    [pcProd_cmTabbedContent6] [nvarchar(MAX)] NULL,
    [pcProd_cmTabContentTitle1] [nvarchar(50)] NULL,
    [pcProd_cmTabContentTitle2] [nvarchar(50)] NULL,
    [pcProd_cmTabContentTitle3] [nvarchar(50)] NULL,
    [pcProd_cmTabContentTitle4] [nvarchar(50)] NULL,
    [pcProd_cmTabContentTitle5] [nvarchar(50)] NULL,
    [pcProd_cmTabContentTitle6] [nvarchar(50)] NULL);


    This form was also not successful:
    ALTER TABLE products ADD
    (pcProd_cmTabbedContent1 nvarchar(MAX) NULL,
    pcProd_cmTabbedContent2 nvarchar(MAX) NULL,
    pcProd_cmTabbedContent3 nvarchar(MAX) NULL,
    pcProd_cmTabbedContent4 nvarchar(MAX) NULL,
    pcProd_cmTabbedContent5 nvarchar(MAX) NULL,
    pcProd_cmTabbedContent6 nvarchar(MAX) NULL,
    pcProd_cmTabContentTitle1 nvarchar(50) NULL,
    pcProd_cmTabContentTitle2 nvarchar(50) NULL,
    pcProd_cmTabContentTitle3 nvarchar(50) NULL,
    pcProd_cmTabContentTitle4 nvarchar(50) NULL,
    pcProd_cmTabContentTitle5 nvarchar(50) NULL,
    pcProd_cmTabContentTitle6 nvarchar(50) NULL);

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    remove the parentheses

    and, if at all possible, think about redesigning the table -- any time you have colname1, colname2, colname3, etc., you are violating first normal form and your queries will be messy and inefficient

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, removing the OUTER parentheses solved it. As for your concerns about the naming conventions, these are general purpose fields and I believe the naming convention is appropriate for the intended use.

    thanks so much.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    well, it wasn't the names of the columns that was the issue, but rather the fact that there's two sets of repeating columns

    "general purpose fields" is usually a bad idea, but you're da boss

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •