Hi, I've had a look around the forums but I couldn't find a specific answer to my query.
I'm following a worksheet I was given from university. We have just started working on SQL and databases and on the worksheet it uses SQL 2008 Server Management Studio.
The version I had couldn't design tables or database or something so I had to get 2012.
I followed the sheet but when I tried to add data to the table using the information from the sheet, I had errors such as:

Msg 102, Level 15, State 1, Line 9
Incorrect syntax near '<'.

It even throws the error with the code/data that is there to begin with.
The current code is:

USE [PPPCars]
GO

INSERT INTO [CarsSchema].[Car]
           ([reg]
           ,[make]
           ,[model]
           ,[colour]
           ,[date])
     VALUES
           (<reg, varchar(10),>
           ,<make, varchar(10),>
           ,<model, varchar(30),>
           ,<colour, varchar(10),>
           ,<date, date,>)
GO

what the sheet is telling me to enter is basically filling in the values in this format:

                ("N57CPD"
                ,"Renault"
                ,"Clio Sport"
                ,"Red"
                ,"2012-01-12"

I'm really confused as this is the first time I have touched this sort of stuff and when I do look for help, all the tech terms are used and I can really see a problem that quite fits these parameters.
Help is very much appreciated.

Recommended Answers

All 4 Replies

Why are you including greater and less than symbols in your SQL statement?

That was generate automatically when I inserted the script. I had to change those values with the ones on the bottom piece of code but it kept coming up with syntax errors like the message above.

A typical SQL insert statement would look like this..

 INSERT INTO tableName ([fieldName], [...]) VALUES ('value1', ' ... ')

Ah right, that's worked :P Thank you so much for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.