You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the following codes to create schema, but always failed:
str_sql :=USE [test001]; GO CREATE SCHEMA [test3] GO
_,err := conn.Exec(str_sql)
always return the error: CREATE SCHEMA' must be the first statement in a query batch.
Can anyone help this issue, thanks!
Describe the bug
A clear and concise description of what the bug is.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Exception message:
Stack trace:
To Reproduce
Include a complete code listing that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
Expected behavior
A clear and concise description of what you expected to happen.
Further technical details
SQL Server version: (e.g. SQL Server 2017)
Operating system: (e.g. Windows 2019, Ubuntu 18.04, macOS 10.13, Docker container)
Table schema
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
On Sat, May 21, 2022, 00:52 bokwoon95 ***@***.***> wrote:
1. Remove the GO statement. That is not valid SQL, it only works in
SSMS.
2. You cannot use CREATE SCHEMA together with other SQL statements (
https://stackoverflow.com/q/5748056). Wrap it in EXEC().
conn.Exec("USE [test001]; EXEC('CREATE SCHEMA [test3]');")
—
Reply to this email directly, view it on GitHub
<#738 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFYLMO4GGUK4A7HQ5XA37DVLB22VANCNFSM5UU3W4WA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
I use the following codes to create schema, but always failed:
str_sql :=
USE [test001]; GO CREATE SCHEMA [test3] GO
_,err := conn.Exec(str_sql)
always return the error:
CREATE SCHEMA' must be the first statement in a query batch.
Can anyone help this issue, thanks!
Describe the bug
A clear and concise description of what the bug is.
If you are seeing an exception, include the full exceptions details (message and stack trace).
To Reproduce
Include a complete code listing that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
Expected behavior
A clear and concise description of what you expected to happen.
Further technical details
SQL Server version: (e.g. SQL Server 2017)
Operating system: (e.g. Windows 2019, Ubuntu 18.04, macOS 10.13, Docker container)
Table schema
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: