Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 6th, 2005, 09:34 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Montreal, Quebec, Canada.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default syntax problem with SQL

Hi I'm VERY new to SQL and am having trouble with its syntax.
Brief: I need to add columns to my table that will be named TITLE, DESCRIPTION KEYWORDS ...that simple!

Here's my code:

ALTER TABLE Products ADD COLUMN description TITLE


Here's the error message:

Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'COLUMN'.


AS always Your help is greatly appreciated,
Thanks

nancy
Reply With Quote
  #2 (permalink)  
Old May 6th, 2005, 09:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

If its the basic syntax you're stuck with you could just look it up in Books On Line.

w3schools always have good basic tutorials:
http://www.w3schools.com/sql/

Your statement doesn't need the COLUMN keyword to add a column (but you do need it to drop a column!), and you also need to specify the data type of the new field. Plus you need one ALTER statement for each new column.
Reply With Quote
  #3 (permalink)  
Old May 6th, 2005, 09:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Sorry I'm wrong, you don't need one ALTER statement per column, you can separate multiple columns by a ,
Reply With Quote
  #4 (permalink)  
Old May 6th, 2005, 12:45 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can also add the column(s) through enterpise manager.

Reply With Quote
  #5 (permalink)  
Old May 6th, 2005, 12:56 PM
Friend of Wrox
 
Join Date: Jun 2004
Location: Montreal, Quebec, Canada.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To all,Thank you very much.
It was indeed a syntax error that is now resolved.

Nancy
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with SQL syntax DeannaF829 VB Databases Basics 2 April 30th, 2007 12:12 PM
SQL-syntax grstad SQL Language 9 January 30th, 2007 02:40 PM
SQL Syntax Cinderella Classic ASP Basics 3 July 21st, 2004 01:06 PM
SQL Syntax jeffg22 SQL Language 6 July 28th, 2003 06:41 PM
sql server syntax problem mateenmohd SQL Server 2000 3 June 23rd, 2003 07:31 PM



All times are GMT -4. The time now is 04:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.