|
Subject:
|
CREATE TABLE syntax error
|
|
Posted By:
|
RaCheer
|
Post Date:
|
1/28/2006 5:50:28 PM
|
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!
~Rachel
|
|
Reply By:
|
jbenson001
|
Reply Date:
|
1/29/2006 12:46:11 AM
|
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.
Jim
|