John, I am trying to simplify the data tables created by a commercial form module I am using; currently, all of the data go into ONE column and there are two tables with a myriad of IDs linking the questions to each respective record, which, clearly based on the questions I am about to ask, is way, WAY over my SQL head. :) I think I can manage the data if each form and its records went into its own table. Therefore, I was given the following: CREATE TABLE mycustomtable
(
mytable_id smallint
IDENTITY(1,1)
PRIMARY KEY CLUSTERED,
FirstName varchar(300) NULL,
LastName varchar(300) NULL,
) ...couple of questions to understand what's going on here. If I used HOTEL as the custom table name, would the syntax be: CREATE TABLE HOTEL (HOTEL_ID smallint...? The mycustomtable and mytable throws me off. :) The Identity and Primary key are used to create a unique ID for each record? I am just wondering what's going on here.... Lastly, I am using about a dozen variables for each form; some are dates, some currency, some text, so integers, etc. Since I am only trying to create a grid view that allows for a simple query/filter, could I just set all fields to varchar and not run into any problems down the road? Would sorts still function properly? So, for example, I was going to use the following: CREATE TABLE Hotel (
hotel_id smallint
IDENTITY(1,1)
PRIMARY KEY CLUSTERED,
h_status varchar(100) NULL,
h_bid varchar(50) NULL,
h_checkin varchar(50) NULL,
...etc
) Am I heading in the right direction here? |