1,105,447 Community Members

SQL 2008 R2 query syntax to SQL 2012 syntax Help

Member Avatar
subtlehulk
Newbie Poster
9 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
JorgeM
IT Addict
6,421 posts since Dec 2011
Reputation Points: 581 [?]
Q&As Helped to Solve: 963 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

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

Member Avatar
subtlehulk
Newbie Poster
9 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
JorgeM
IT Addict
6,421 posts since Dec 2011
Reputation Points: 581 [?]
Q&As Helped to Solve: 963 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

A typical SQL insert statement would look like this..

 INSERT INTO tableName ([fieldName], [...]) VALUES ('value1', ' ... ')
Question Answered as of 1 Year Ago by JorgeM
Member Avatar
subtlehulk
Newbie Poster
9 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: