Well, I was using SQL Server Enterprise Manager. I don't
have the CREATE statements written out. I already have
the tables made. This is the CREATE statement generated
by the 'AutoGeneral' table I already have:
CREATE TABLE [dbo].[AutoGeneral] (
[AutoVIN] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AutoYear] [smallint] NOT NULL ,
[AutoMake] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AutoModel] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AutoMiles] [int] NOT NULL ,
[AutoPrice] [smallmoney] NOT NULL ,
[AutoWarranty] [bit] NOT NULL ,
[AutoWarrantyLength] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AutoType] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AutoTransmission] [bit] NOT NULL ,
[AutoSpeeds] [tinyint] NULL ,
[AutoFuel] [tinyint] NOT NULL ,
[AutoEngine] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[AutoDrive] [tinyint] NOT NULL ,
[AutoDoors] [tinyint] NOT NULL ,
[AutoHatch] [bit] NOT NULL ,
[AutoAC] [bit] NOT NULL ,
[AutoRadio] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AutoExtColor] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AutoIntColor] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[AutoOther] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL
)
And here is the AutoOptions:
CREATE TABLE [dbo].[AutoOptions] (
[ABS] [bit] NOT NULL ,
[Airbags] [bit] NOT NULL ,
[CruiseControl] [bit] NOT NULL ,
[DayRunLight] [bit] NOT NULL ,
[FogLight] [bit] NOT NULL ,
[GPS] [bit] NOT NULL ,
[HeatMirror] [bit] NOT NULL ,
[HeatSeat] [bit] NOT NULL ,
[LeathInt] [bit] NOT NULL ,
[RoofRack] [bit] NOT NULL ,
[Sunroof] [bit] NOT NULL ,
[MultiWheel] [bit] NOT NULL ,
[OnStar] [bit] NOT NULL ,
[Keyless] [bit] NOT NULL ,
[Antenna] [bit] NOT NULL ,
[Locks] [bit] NOT NULL ,
[Mirror] [bit] NOT NULL ,
[Seats] [bit] NOT NULL ,
[Steering] [bit] NOT NULL ,
[Windows] [bit] NOT NULL ,
[Wipers] [bit] NOT NULL ,
[RearDefrost] [bit] NOT NULL ,
[RemDoor] [bit] NOT NULL ,
[RemTrunk] [bit] NOT NULL ,
[SecureSys] [bit] NOT NULL ,
[Spoiler] [bit] NOT NULL ,
[TowPack] [bit] NOT NULL ,
[TractCon] [bit] NOT NULL ,
[AlumWheel] [bit] NOT NULL ,
[ChromeWheel] [bit] NOT NULL
)
All of the values are pulled from a web form. This is for
keeping track of used car inventory online. The
AutoGeneral table is for all of the main automobile info,
and the AutoOptions table is for all the extra options. I
wanted to assign an AutoID to each row entered into the
two tables, so I can reference the two rows by calling one
unique ID. Follow? For example:
/ ----AutoGeneral----AutoID + AutoGeneral Values
NewEntry1 Same
(Values from |
the web form)\ Same
--AutoOptions---AutoID + AutoOptions Values
I just want the value of AutoID to start at 1, and
increment +1 for each new set of values, or row, entered
into the two tables.
Quote:>-----Original Message-----
>Can you post your table DDLs(CREATE table statements),
sample
>data as INSERT statements & expected results?
>--
>- Anith
>.