Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
| Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 28th, 2006, 06:50 PM
Registered User
Join Date: Jan 2006
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default CREATE TABLE syntax error

I am working on a table design for class and it is required that we use a query to create it. My query is:

CREATE TABLE Cust (customer_number CHAR(3),
                   address VARCHAR(20),
                   balance NUMBER(5));

Each time I try to tun it I get:

Syntax error in CREATE TABLE statement.

I've replaced NUMBER with several other things like NUMERIC, INTEGER, CURRENCY etc. When I take off the 5 it accepts it. The book is asking for a numeric balance of five digits. Everything runs ok up until that point.

The exact question is:

Create a table called Cust with a customer number as a fixed-length character string of 3, an address with a variable-length character string of up to 20, and a numeric balance of five digits.

I've been up at school all day and I've even had tutors try to help me and they were unsuccessful! Any help would be greatly appreciated!

  #2 (permalink)  
Old January 29th, 2006, 01:46 AM
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

Is the numeric data decimal? If so, you need to know the number of digits before and after the decimal.
decimal (5,2) will give you a total of 5 numbers, 3 before the decimal and 2 after. The requirement is vague, you need to get clarifiaction on it. In sql server there is no way to specify a numeric type that holds a specified number of digits ie numeric(5). The only way to do that would be to use a Char(5). But I don't suggest using a character field to hold numeric data.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create generic XSL Template to create table Venkatachalapathy XSLT 5 March 11th, 2008 07:49 AM
Create table statement syntax error in access 2000 method Access 1 August 8th, 2005 02:10 AM
What is the syntax of create table and insert stat method Access 1 June 27th, 2005 02:29 PM
$sql="CREATE TABLE syntax error cedtech23 Beginning PHP 3 August 24th, 2004 04:56 AM
CREATE TABLE error in MySQL k4rm4killer PHP Databases 2 December 9th, 2003 01:05 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.