Problem Insert Statement

  • Good Day !!!

    I'm experiencing difficulties with a problematic Insert statement.  Could you please spare me a 2nd set of eyes to see what I'm missing here ?

    Thanks in advance.

    Don

    Here's error message :

    Server: Msg 128, Level 15, State 1, Line 14

    The name '| GSL Account Search' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

    Here's the table definition :

    CREATE TABLE [dbo].[tbMenus] ([tbMenus_ItemID] [int] IDENTITY (1, 1) NOT NULL ,

    [tbMenus_Item] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,

    [tbMenus_Parent_ItemID] [int] NULL ,

    [luDirectory_ID] [int] NOT NULL ,

    [tbMenus_Item_Link] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [tbMenus_Item_Link_Image] [varchar] (120) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [tbMenus_Item_Full_URL] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [tbMenus_Sequence] [int] NOT NULL ,

    [tbMenus_Condition_text] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON[PRIMARY]

    Here's my problematic Insert statement :

    INSERT INTO tbMenus

    (tbMenus_ItemID,

    tbMenus_Item,

    tbMenus_Parent_ItemID,

    luDirectory_ID,

    tbMenus_Item_Link,

    tbMenus_Item_Link_Image,

    tbMenus_Item_Full_URL,

    tbMenus_Sequence,

    tbMenus_Condition_text)

    VALUES

    (335,

    "| GSL Account Search",

    ,

    6,

    ,

    ,

    "javascript:window.open(\'http://addcsr11:8080/CSR/Jsp/search.jsp\',\'ExpressPay\',\'\').focus();void(0)",

    12,);

  • Take the double quotes off of "| GSL Account Search".  Use single quotes.  Also, you have multiple stray commas in your insert statements.  If you include the column name in your Insert clause, you need a valid value in your Values clause.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • SQL uses single quotes not double

    INSERT INTO tbMenus

    (tbMenus_ItemID,

    tbMenus_Item,

    tbMenus_Parent_ItemID,

    luDirectory_ID,

    tbMenus_Item_Link,

    tbMenus_Item_Link_Image,

    tbMenus_Item_Full_URL,

    tbMenus_Sequence,

    tbMenus_Condition_text)

    VALUES

    (335,

    '| GSL Account Search',

    ,

    6,

    ,

    ,

    'javascript:window.open(\''http://addcsr11:8080/CSR/Jsp/search.jsp\'',\''ExpressPay\'',\''\'').focus();void(0)',

    12,);

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply