Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using SQL to CREATE a TABLE 1

Status
Not open for further replies.

PublisoftTelecom

Programmer
Apr 4, 2000
6
CA
I'm using an ACCESS database for a Web application in Cold Fusion and I need to create a table dynamically.&nbsp;&nbsp;<br><br>So far it's not so complicated... I use CREATE TABLE and that's it!!!&nbsp;&nbsp;My problem is that I need to define a TEXT field that will allows NULL entries. (Allow zero length Property)<br><br>Thanks for the help!
 
You're better off taking this to the Access group and not here.&nbsp;&nbsp;Cold Fusion code won't help you in this situation. <br><br>Sounds like you need to use a storedproc and create a table using that. <p> <br><a href=mailto:aberman@thebiz.net>aberman@thebiz.net</a><br><a href= > </a><br>Database programmer and developer, fueled by peach snapple.
 
As an Access guru and a pretend programmer :) I might be able to help.&nbsp;&nbsp;Can you provide a little more info on what you're trying to do?
 
I need to populate dynamically a table.&nbsp;&nbsp;So far I'm going weel, I'm able to create it with the following code:<br><br><b>CREATE TABLE ChoixReponse<br>(<br>&nbsp;&nbsp;choixReponseID COUNTER <br>&nbsp;&nbsp;&nbsp;&nbsp;CONSTRAINT PrimaryKey PRIMARY KEY,<br>&nbsp;&nbsp;choixReponseNom TEXT(50) <br>)</b><br><br>The problem is that I can't set the TEXT field to allow NULL which is the <i>Allow zero length Property</i> in ACCESS Database Designer.&nbsp;&nbsp;<br><br>I tried <br><br>&nbsp;&nbsp;&nbsp;<b>choixReponseNom TEXT(50) NULL</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt; <font color=red>didn't work!</font><br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;<b>CREATE INDEX creerIndex<br>&nbsp;&nbsp;&nbsp;ON ChoixReponse (choixReponseNom) <br>&nbsp;&nbsp;&nbsp;WITH IGNORE NULL</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt; <font color=red>didn't work much!</font><br><br>I'm realy out of ideas so if you can help KimiSue (or anybody else!) I'll be very glad.<br><br>
 
The easiest way to allow Access DB to accept a null value is as follows:<br><br>1. Open the table that includes the field in Design view.<br><br>2. Click the field in which you want to enter a zero-length string.<br><br>3. Set the AllowZeroLength field property to &quot;Yes&quot;. <br><br>Note&nbsp;&nbsp;&nbsp;Only Text, Memo, and Hyperlink fields can accept zero-length strings.<br><br>Hope this helps.<br>jdf142<br>
 
Yeah I know!&nbsp;&nbsp;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;But I need to do it DYNAMICALLY... With code...&nbsp;&nbsp;I don't have access to the designer while I'm browsing my application on the web!
 
I don't know much about Access, but as far as I know it is the 'Required' property which is set to no by NULL in SQL. What you want to influence is the 'Allow Zero Length' property, which is set in some other way.<br><br>I am sure there is a neater way of doing it, but you could always create a table containing a field with 'Allow Zero Length' set and then copy this into your new table using SELECT ... INTO; then use ALTER TABLE to alter it to whatever you wanted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top