SQL 2008

SQL Server Management Studio

Page 1 of 1

8 Replies - 1852 Views - Last Post: 13 February 2009 - 09:32 AM Rate Topic: -----

#1 globalnetwork  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-February 09

SQL 2008

Posted 12 February 2009 - 09:55 AM

Hello
Basically I am in this SQL class we were given an assignment to create a database and two tables. Below is a simple created database and table asking simply the first and last name, I have errors evening coming up on this one as well as my assignmenrt but to keep ir simple I used the small database/table. Seems to all happen when I use the INSERT statement as you can see below. Any helpful tips would be appreciated. I am using SQL Server Management Studio. If interested I have the attachment of the assignment but please send me email to info@global-network.ws in the SUBJECT put CAN HELP WITH ASSIGNMENT

INSERT INTO [Contacts].[dbo].[contents]
		   ([LastName]
		   ,[FirstName])
	 VALUES
		   (<LastName, nchar(10),>
		   ,<FirstName, nchar(10),>)
GO


insert into contents (LastName, FirstName)
values ('Hayward', 'Ken')




ERROR msg is below

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

(1 row(s) affected)

Is This A Good Question/Topic? 0
  • +

Replies To: SQL 2008

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: SQL 2008

Posted 12 February 2009 - 10:01 AM

First of all this should be in the databases forum (So I'll move it)

Second what is this code for?

INSERT INTO [Contacts].[dbo].[contents]
		   ([LastName]
		   ,[FirstName])
	 VALUES
		   (<LastName, nchar(10),>
		   ,<FirstName, nchar(10),>)
GO



Is this supposed to be the code for creating your table? If so it's wrong. The CREATE TABLE should look like this

CREATE TABLE dbo.Contacts
		   LastName VARCHAR(10),
		   FirstName VARCHAR(10)
GO



After that's ran you can run your insert statement. I hope this what you were asking :)
Was This Post Helpful? 0
  • +
  • -

#3 globalnetwork  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-February 09

Re: SQL 2008

Posted 12 February 2009 - 10:17 AM

Thanks for the post and uploading to right forum but the database is already created we were to query an insert statement try to input data into the database.
Every time I attempt to input data using the INSERT statement
in the error list upon typing
INSERT
I receive
Incorrect syntax near "End of File"
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: SQL 2008

Posted 12 February 2009 - 10:20 AM

End of file, in Transact-SQL? An INSERT statement is simple

INSERT INTO
		 contents (LastName, FirstName)
VALUES
		 ('Hayward', 'Ken')



That will insert Ken Hayward into a table names contents with a first and last name column
Was This Post Helpful? 0
  • +
  • -

#5 globalnetwork  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-February 09

Re: SQL 2008

Posted 12 February 2009 - 01:07 PM

Hello....
Thanks for the response I think it is T-Sql
I have included an attachment if you have time and want to take a look at it, I receive errors right from the start, probably someone that is more knowledgable with SQL can probably look at this as a simple config or something.
Thanks Ken
Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: SQL 2008

Posted 12 February 2009 - 04:13 PM

There is no attachment on your post so go ahead and show me the code that is causing the error you're receiving :)
Was This Post Helpful? 0
  • +
  • -

#7 globalnetwork  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-February 09

Re: SQL 2008

Posted 12 February 2009 - 10:37 PM

I tried this upload again but gave me this message

Upload failed. You are not permitted to upload a file with that file extension

Bur yet gives me the option to add attachment if you give a message with your email I can send the attachment.
Thanks Appreciation Ken
PS I hate to see what Friday the 13th is going to bring after this week of IT issues.
Was This Post Helpful? 0
  • +
  • -

#8 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: SQL 2008

Posted 12 February 2009 - 11:40 PM

What extension are you trying to upload? If it's other than an image or zip file then you cant upload it
Was This Post Helpful? 0
  • +
  • -

#9 globalnetwork  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-February 09

Re: SQL 2008

Posted 13 February 2009 - 09:32 AM

Hello
Is this the use of the INSERT statement or do I use INSERT statement with a record after the GO at the bottom?



INSERT INTO [KudlerFineFoods].[dbo].[Employee]

([Emp_ID]

,[Last_name]

,[First_name]

,[Address_current]

,[City]

,[State_current]

,[Telephone_area_code]

,[Telephone_number]

,[EEO_1_classification]

,[Hire_date]

,[Salary]

,[Gender]

,[Age]

,[Foreign_key])

VALUES

('3433'

,'Joe'

,<First_name, varchar(50),>

,<Address_current, varchar(50),>

,<City, varchar(20),>

,<State_current, varchar(20),>

,<Telephone_area_code, varchar(20),>

,<Telephone_number, varchar(20),>

,<EEO_1_classification, varchar(50),>

,<Hire_date, varchar(20),>

,<Salary, varchar(10),>

,<Gender, varchar(10),>

,<Age, varchar(10),>

,<Foreign_key, varchar(50),>)

GO

INSERT into Employee (Last_name,First_name) persons name within brackets
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1