Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>>I am executing an SQL INSERT from a NET website. The insert statement has an incomplete list of the fields in the table. The intention is that the fields not listed would be left blank. The table is structured to not allow null values. The insert from the website fails with a message that the field does not allow null values. I am trying to find a way to deal with this. One solution is to revise the table to allow the nulls but this is undesireable. Another solution might be to establish a default value for each field (untested). But this is also undesireable. I would prefer the empty fields just be left blank.
>>
>>Any suggestions on how I might accomplish this?
>
>Hi,
>Supply a complete list of fields in the INSERT :-}
>Use a SP instead of the INSERT ?
Hi Viv, there are 174 fields in the table. Only a few of them are receiving values with the insert (and those are determined programmatically). So I like the second idea better. I've tried a stored proc to delete the nulls without success but perhaps an SP to perform the actual insert would work. How would that be structured? Simply pass the SQL statement to the SP and let it execute it?
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement