[thelist] SQL basic questions

ted serbinski tss24 at cornell.edu
Mon Jan 21 19:42:18 CST 2002

I'm new to MS SQL/CF and have 3 basic questions but ones I can't find a
good answer to. Here goes:

Question 1.

I created a database in MS SQL called 'activity'. This is in the same
spot as the 'master' database (or in same directory). I went into cold
fusion and set up LocalServer (the default MS SQL setup) to point to
'activity' in the admin page. However, when I run this code, it inserts
the table into the 'master' database and not the activity database. Any

<cfquery name="add" datasource="LocalServer">
  CREATE TABLE #temp#  //this is just a variable name from above based
on a loop
  LastName text,
  FirstName text,
  Gender text,
  Grade smallint,
  Race text

Question 2.

Is there a way to detect if a table is present and has X, Y, and Z
fields setup? If not, to create the table and/or add/delete fields?

Question 3.

When adding new rows to the database, is there a quick way or function
to auto assign a new ID # to that row? Also what would be the advantage
of this? Would this help in say linking a table teacher with the ID# of
a student?

Thanks for any and all help. Extremely appreciated.


More information about the thelist mailing list