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
)
sql-server visual-studio
add a comment |
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
)
sql-server visual-studio
1
I hope you don't actually name your tableTable
.
– 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
add a comment |
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
)
sql-server visual-studio
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
sql-server visual-studio
edited Aug 3 at 9:38
jarlh
28k52137
28k52137
asked Aug 3 at 8:17
csi
154
154
1
I hope you don't actually name your tableTable
.
– 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
add a comment |
1
I hope you don't actually name your tableTable
.
– 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
add a comment |
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
)
add a comment |
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
)
add a comment |
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
)
add a comment |
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
)
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
)
answered Aug 3 at 8:21
Rene Niediek
1018
1018
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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