sql error in visual studio











up vote
0
down vote

favorite












why I am getting the following error?




Error 11 SQL71006: Only one statement is allowed per batch. A batch
separator, such as 'GO', might be required between
statements. dbo.Table_1 1 1




Here is my code:



  IF OBJECT_ID('Database1') IS NOT NULL
DROP TABLE Table_1;

CREATE TABLE [dbo].[Table]
(
[departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
[specializare] VARCHAR(MAX) NOT NULL,
[student] VARCHAR(MAX) NOT NULL,
[profesor] VARCHAR(MAX) NOT NULL
)









share|improve this question




















  • 1




    I hope you don't actually name your table Table.
    – Filburt
    Aug 3 at 8:22










  • Well, it would be worse if it was named [View] ;). But it's just a simplification. The name used in the OBJECT_ID should be probably something like 'Database1.dbo.Table_1' though. Funny that you don't need a GO in SSMS, probably because of the auto-commit.
    – LukStorms
    Aug 3 at 8:31












  • The reason why this happens is described here: dba.stackexchange.com/a/34661/91898
    – Peter B
    Aug 3 at 9:48















up vote
0
down vote

favorite












why I am getting the following error?




Error 11 SQL71006: Only one statement is allowed per batch. A batch
separator, such as 'GO', might be required between
statements. dbo.Table_1 1 1




Here is my code:



  IF OBJECT_ID('Database1') IS NOT NULL
DROP TABLE Table_1;

CREATE TABLE [dbo].[Table]
(
[departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
[specializare] VARCHAR(MAX) NOT NULL,
[student] VARCHAR(MAX) NOT NULL,
[profesor] VARCHAR(MAX) NOT NULL
)









share|improve this question




















  • 1




    I hope you don't actually name your table Table.
    – Filburt
    Aug 3 at 8:22










  • Well, it would be worse if it was named [View] ;). But it's just a simplification. The name used in the OBJECT_ID should be probably something like 'Database1.dbo.Table_1' though. Funny that you don't need a GO in SSMS, probably because of the auto-commit.
    – LukStorms
    Aug 3 at 8:31












  • The reason why this happens is described here: dba.stackexchange.com/a/34661/91898
    – Peter B
    Aug 3 at 9:48













up vote
0
down vote

favorite









up vote
0
down vote

favorite











why I am getting the following error?




Error 11 SQL71006: Only one statement is allowed per batch. A batch
separator, such as 'GO', might be required between
statements. dbo.Table_1 1 1




Here is my code:



  IF OBJECT_ID('Database1') IS NOT NULL
DROP TABLE Table_1;

CREATE TABLE [dbo].[Table]
(
[departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
[specializare] VARCHAR(MAX) NOT NULL,
[student] VARCHAR(MAX) NOT NULL,
[profesor] VARCHAR(MAX) NOT NULL
)









share|improve this question















why I am getting the following error?




Error 11 SQL71006: Only one statement is allowed per batch. A batch
separator, such as 'GO', might be required between
statements. dbo.Table_1 1 1




Here is my code:



  IF OBJECT_ID('Database1') IS NOT NULL
DROP TABLE Table_1;

CREATE TABLE [dbo].[Table]
(
[departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
[specializare] VARCHAR(MAX) NOT NULL,
[student] VARCHAR(MAX) NOT NULL,
[profesor] VARCHAR(MAX) NOT NULL
)






sql-server visual-studio






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 3 at 9:38









jarlh

27.9k52137




27.9k52137










asked Aug 3 at 8:17









csi

154




154








  • 1




    I hope you don't actually name your table Table.
    – Filburt
    Aug 3 at 8:22










  • Well, it would be worse if it was named [View] ;). But it's just a simplification. The name used in the OBJECT_ID should be probably something like 'Database1.dbo.Table_1' though. Funny that you don't need a GO in SSMS, probably because of the auto-commit.
    – LukStorms
    Aug 3 at 8:31












  • The reason why this happens is described here: dba.stackexchange.com/a/34661/91898
    – Peter B
    Aug 3 at 9:48














  • 1




    I hope you don't actually name your table Table.
    – Filburt
    Aug 3 at 8:22










  • Well, it would be worse if it was named [View] ;). But it's just a simplification. The name used in the OBJECT_ID should be probably something like 'Database1.dbo.Table_1' though. Funny that you don't need a GO in SSMS, probably because of the auto-commit.
    – LukStorms
    Aug 3 at 8:31












  • The reason why this happens is described here: dba.stackexchange.com/a/34661/91898
    – Peter B
    Aug 3 at 9:48








1




1




I hope you don't actually name your table Table.
– Filburt
Aug 3 at 8:22




I hope you don't actually name your table Table.
– Filburt
Aug 3 at 8:22












Well, it would be worse if it was named [View] ;). But it's just a simplification. The name used in the OBJECT_ID should be probably something like 'Database1.dbo.Table_1' though. Funny that you don't need a GO in SSMS, probably because of the auto-commit.
– LukStorms
Aug 3 at 8:31






Well, it would be worse if it was named [View] ;). But it's just a simplification. The name used in the OBJECT_ID should be probably something like 'Database1.dbo.Table_1' though. Funny that you don't need a GO in SSMS, probably because of the auto-commit.
– LukStorms
Aug 3 at 8:31














The reason why this happens is described here: dba.stackexchange.com/a/34661/91898
– Peter B
Aug 3 at 9:48




The reason why this happens is described here: dba.stackexchange.com/a/34661/91898
– Peter B
Aug 3 at 9:48












1 Answer
1






active

oldest

votes

















up vote
0
down vote













You are missing a GO between the Statements.



    IF OBJECT_ID('Database1') IS NOT NULL
DROP TABLE Table_1;
GO
CREATE TABLE [dbo].[Table]
(
[departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
[specializare] VARCHAR(MAX) NOT NULL,
[student] VARCHAR(MAX) NOT NULL,
[profesor] VARCHAR(MAX) NOT NULL
)





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51668196%2fsql-error-in-visual-studio%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You are missing a GO between the Statements.



        IF OBJECT_ID('Database1') IS NOT NULL
    DROP TABLE Table_1;
    GO
    CREATE TABLE [dbo].[Table]
    (
    [departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
    [specializare] VARCHAR(MAX) NOT NULL,
    [student] VARCHAR(MAX) NOT NULL,
    [profesor] VARCHAR(MAX) NOT NULL
    )





    share|improve this answer

























      up vote
      0
      down vote













      You are missing a GO between the Statements.



          IF OBJECT_ID('Database1') IS NOT NULL
      DROP TABLE Table_1;
      GO
      CREATE TABLE [dbo].[Table]
      (
      [departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
      [specializare] VARCHAR(MAX) NOT NULL,
      [student] VARCHAR(MAX) NOT NULL,
      [profesor] VARCHAR(MAX) NOT NULL
      )





      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        You are missing a GO between the Statements.



            IF OBJECT_ID('Database1') IS NOT NULL
        DROP TABLE Table_1;
        GO
        CREATE TABLE [dbo].[Table]
        (
        [departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
        [specializare] VARCHAR(MAX) NOT NULL,
        [student] VARCHAR(MAX) NOT NULL,
        [profesor] VARCHAR(MAX) NOT NULL
        )





        share|improve this answer












        You are missing a GO between the Statements.



            IF OBJECT_ID('Database1') IS NOT NULL
        DROP TABLE Table_1;
        GO
        CREATE TABLE [dbo].[Table]
        (
        [departament] VARCHAR(MAX) NOT NULL PRIMARY KEY,
        [specializare] VARCHAR(MAX) NOT NULL,
        [student] VARCHAR(MAX) NOT NULL,
        [profesor] VARCHAR(MAX) NOT NULL
        )






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 3 at 8:21









        Rene Niediek

        1018




        1018






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51668196%2fsql-error-in-visual-studio%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Full-time equivalent

            さくらももこ

            13 indicted, 8 arrested in Calif. drug cartel investigation