INSERT script errors *** Gurus help needed ***

  • USE SmartTrack

    GO

    DECLARE @C2CActionID INT

    DECLARE @BulkActionID INT

    DECLARE @ImportActionID INT

    DECLARE @C2CMenuItemID INT

    DECLARE @BulkMenuItemID INT

    DECLARE @ImportMenuItemID INT

    DECLARE @TransferMenuItemID INT

    INSERT INTO [Action] ([Name], ActionGroupID) VALUES ('Card to Card Transfer', 2);

    SELECT @C2CActionID = @@IDENTITY

    INSERT INTO [Action] ([Name], ActionGroupID) VALUES ('Bulk Card Loading', 2);

    SELECT @BulkActionID = @@IDENTITY

    INSERT INTO [Action] ([Name], ActionGroupID) VALUES ('Import Cards', 2);

    SELECT @ImportActionID = @@IDENTITY

    INSERT INTO [ViewPageAction] (ActionID, Url, RequiresAuthentication, RequiresAuthorization) VALUES (@C2CActionID, '/Cardholder/CardToCard.aspx', 1, 1);

    INSERT INTO [ViewPageAction] (ActionID, Url, RequiresAuthentication, RequiresAuthorization) VALUES (@BulkActionID, '/Cardholder/BulkLoad.aspx', 1, 1);

    INSERT INTO [ViewPageAction] (ActionID, Url, RequiresAuthentication, RequiresAuthorization) VALUES (@ImportActionID, '/Cardholder/ImportCards.aspx', 1, 1);

    INSERT INTO [WebMenuItems] (ItemType, Text, Attribute) VALUES (2, 'Card to Card Transfer', CONVERT(VARCHAR(5), @C2CActionID);

    INSERT INTO [WebMenuItems] (ItemType, Text, Attribute) VALUES (2, 'Bulk Card Loading', CONVERT(VARCHAR(5), @BulkActionID);

    INSERT INTO [WebMenuItems] (ItemType, Text, Attribute) VALUES (2, 'Import Cards', CONVERT(VARCHAR(5), @ImportActionID);

    INSERT INTO [WebMenuItems] (ItemType, Text, Attribute) VALUES (2, 'Transfer Money', CONVERT(VARCHAR(5), @C2CActionID);

    INSERT INTO [WebMenuActionMap] (MenuItemID, ActionID) VALUES (@C2CMenuItemID, @C2CActionID);

    INSERT INTO [WebMenuActionMap] (MenuItemID, ActionID) VALUES (@BulkMenuItemID, @BulkActionID);

    INSERT INTO [WebMenuActionMap] (MenuItemID, ActionID) VALUES (@ImportMenuItemID, @ImportActionID);

    INSERT INTO [WebMenuActionMap] (MenuItemID, ActionID) VALUES (@TransferMenuItemID, @C2CActionID);

    INSERT INTO [WebMenuMenuItemMap] (MenuID, MenuItemID, ItemOrder, Enabled) VALUES (1, @TransferMenuItemID, 2, 1);

    INSERT INTO [WebMenuMenuItemMap] (MenuID, MenuItemID, ItemOrder, Enabled) VALUES (9, @C2CMenuItemID, 3, 1);

    INSERT INTO [WebMenuMenuItemMap] (MenuID, MenuItemID, ItemOrder, Enabled) VALUES (9, @BulkMenuItemID, 2, 1);

    INSERT INTO [WebMenuMenuItemMap] (MenuID, MenuItemID, ItemOrder, Enabled) VALUES (9, @ImportMenuItemID, 4, 1);

    INSERT INTO [UserRoleActionMap] (UserRoleID, ActionID) VALUES (1, @C2CActionID);

    INSERT INTO [UserRoleActionMap] (UserRoleID, ActionID) VALUES (2, @C2CActionID);

    INSERT INTO [UserRoleActionMap] (UserRoleID, ActionID) VALUES (1, @BulkActionID);

    INSERT INTO [UserRoleActionMap] (UserRoleID, ActionID) VALUES (2, @BulkActionID);

    INSERT INTO [UserRoleActionMap] (UserRoleID, ActionID) VALUES (1, @ImportActionID);

    INSERT INTO [UserRoleActionMap] (UserRoleID, ActionID) VALUES (2, @ImportActionID);

    INSERT INTO [UserRoleMenuItemMap] (UserRoleID, MenuItemID) VALUES (1, @C2CMenuItemID);

    INSERT INTO [UserRoleMenuItemMap] (UserRoleID, MenuItemID) VALUES (1, @BulkMenuItemID);

    INSERT INTO [UserRoleMenuItemMap] (UserRoleID, MenuItemID) VALUES (1, @ImportMenuItemID);

    INSERT INTO [UserRoleMenuItemMap] (UserRoleID, MenuItemID) VALUES (2, @C2CMenuItemID);

    INSERT INTO [UserRoleMenuItemMap] (UserRoleID, MenuItemID) VALUES (2, @BulkMenuItemID);

    INSERT INTO [UserRoleMenuItemMap] (UserRoleID, MenuItemID) VALUES (2, @ImportMenuItemID);

    INSERT INTO [UserRoleActionMap] (UserRoleID, ActionID) VALUES (7, @C2CActionID);

    INSERT INTO [UserRoleMenuItemMap] (UserRoleID, MenuItemID) VALUES (7, @C2CMenuItemID);

    INSERT INTO [UserRoleMenuItemMap] (UserRoleID, MenuItemID) VALUES (7, @TransferMenuItemID);

    GO

  • Ummmm.....

    Which of these inserts is throwing the error? (in management studio, if you double click the error in the results pane, it will take you to the line in question)

    What error is it throwing?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • It's throwing an error inserting into the "WebMenuItems" table.

    The error stating incorrect syntax near ')' on those lines for the insert on the "WebMenuItems" table.

  • HI there,

    You missing a closing bracket after you 'CONVERT(VARCHAR(5),@____'

    AT the end you need a ')'

    thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • You are missing a ) at the end of the line.

    You have your closing paran for the CONVERT but not for the VALUES on the insert. It should look like :

    INSERT INTO [WebMenuItems] (ItemType, Text, Attribute) VALUES (2, 'Card to Card Transfer', CONVERT(VARCHAR(5), @C2CActionID));

    INSERT INTO [WebMenuItems] (ItemType, Text, Attribute) VALUES (2, 'Bulk Card Loading', CONVERT(VARCHAR(5), @BulkActionID));

    INSERT INTO [WebMenuItems] (ItemType, Text, Attribute) VALUES (2, 'Import Cards', CONVERT(VARCHAR(5), @ImportActionID));

    INSERT INTO [WebMenuItems] (ItemType, Text, Attribute) VALUES (2, 'Transfer Money', CONVERT(VARCHAR(5), @C2CActionID));

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

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