-3

i'm new in SQL Server and i don't know what happened. i need to create a database,how i can do it?

enter image description here

i have problems

enter image description here

Why the > is show me?

James Z
  • 12,209
  • 10
  • 24
  • 44
sanlegas
  • 109
  • 1
  • 4
  • Try using the `GO` statement. I'd suggest having a read of the `sqlcmd` documentation. SO isn't a website for asking for tutorials. – Thom A Apr 21 '18 at 15:46
  • Are you definitely using the latest drivers? (ODBC 13.1 iirc). – Thom A Apr 21 '18 at 17:24
  • Please state the commands and the errors. The text cannot be copied/pasted by others, and the text cannot be indexed by search engines for future visitors. – jww Apr 22 '18 at 00:32
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Database Administrators Stack Exchange](http://dba.stackexchange.com/) would be a better place to ask. – jww Apr 22 '18 at 00:33

2 Answers2

4

You need to add GO as the batch separator. Nothing will get executed untill you add it e.g.

> CREATE DATABASE TESTDB
> GO

The MS docs are here: https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-linux-2017

dbajtr
  • 2,024
  • 2
  • 14
  • 22
  • 1> CREATE DATABASE prueba 2> go SqlState 24000, Invalid cursor state 1> CREATE DATABASE prueba 2> go SqlState 24000, Invalid cursor state 1> CREATE DATABASE prueba go 2> CREATE DATABASE prueba 3> go SqlState 24000, Invalid cursor state – sanlegas Apr 21 '18 at 15:58
  • are you adding the '>' in, i only included that to show separate lines. Its should just be your create statement on one line and then GO on the next – dbajtr Apr 21 '18 at 16:00
  • it could possibly be down to open connection. disconnect every session and then try again – dbajtr Apr 21 '18 at 16:12
-1
sqlcmd -S localhost -U SA -P yourpassword

CREATE DATABASE database
GO

USE database
GO
qorka
  • 114
  • 1
  • 2
  • 12