Domanda

I'm using SQL Server 2005.

Here are the steps I followed:

  1. Right Click Data Connections.
  2. Added a connection to the server.
  3. Selected Microsoft SQL Server (SQL Client).
  4. Created the database.
  5. Right clicked the tables section.
  6. Pressed Add New Query.
  7. Inserted the SQL statement.
  8. Pressed Execute SQL statement.

I used this SQL statement to try and run it:

CREATE TABLE [dbo].[Title](
    [id] [int] IDENTITY(1000,1) NOT NULL,
    [name] [nvarchar](30) NULL,
    [artist] [nvarchar](40) NULL,
    [price] [money] NULL,
    [length] [float] NULL,
    CONSTRAINT [PK_title] PRIMARY KEY CLUSTERED  ( [id] ASC )
) ON [PRIMARY]
GO

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Dhoom Machale', N'Aditi Singh Sharma', CAST(5.99 AS Money), 7.45)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Mat Maari', N'Kunal Ganjawala, Sunidhi Chauhan', CAST(4.50 AS Money), 6.45)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Paani Paani',N'Honey Singh', CAST(2.90 AS Money), 4.5)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Dhanush Sachin Anthem', N'Dhanush', CAST(3.50 AS Money), 4.45)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Hamari Atariya Pe', N'Rekha Bhardwaj', CAST(4.00 AS Money), 4.43)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Kabhi Jo Badal Barse', N'Arijit Singh', CAST(3.40 AS Money), 5.05)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Do Rang Duniya Ke Aur Do Raste', N'Mukesh', CAST(2.75 AS Money), 4.35)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Mera Joota Hai Japani', N'Mukesh', CAST(1.97 AS Money), 5.15)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Full Jhol', N'Mika Singh, Akasa Singh', CAST(2.45 AS Money), 5.05)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Kaddu Katega', N'Antara Mitra', CAST(3.24 AS Money), 4.25)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Tujse Door Jo Hota Hunn',N'Gajendra Verma', CAST(2.45 AS Money), 3.45)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Chura Liya Hai Tumne Jo Dil Ko',N'Asha Bhosle, Mohammad Rafi', CAST(3.55 AS Money), 4.05)

INSERT INTO [dbo].[Title] ([name],[artist], [price], [length]) 
VALUES (N'Deewana Mujh Sa Nahin',N'Mohammad Rafi', CAST(4.35 AS Money), 4.25)

The error I'm getting is this

Why am I getting this error?

È stato utile?

Soluzione

Take out the GO statement.

Visual Studio / SQL Server Data Tools uses the ADO.NET data provider. GO is not recognized by the database engine, only by Management Studio and OSQL/SQLCMD.

SQL Server GO Keyword

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top