• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

INSET Command

If I have a table containing 50 fields, is there any easy command to insert a blank record with blank values or do I have to list all the field and values in the command ?
0
Los Angeles1
Asked:
Los Angeles1
1 Solution
 
jppintoCommented:
INSERT INTO TableName (Field1Name)
SELECT NULL
0
 
Los Angeles1Author Commented:
Do I have to list all the field names, or just the first one
0
 
Dave FordSoftware Developer / Database AdministratorCommented:

Since you posted in the DB2 area, I'll assume you're talking about some flavor of DB2.

In that case, it's always better (much less error-prone) to list out every column into which you're inserting, but at the very least, your insert statement must list at least one value to insert. All the other columns would end up being null. (Of course, make sure they're null-capable.)

e.g.
insert into deleteme (someColumn)
values ('Some Stuff')

HTH,
DaveSlash
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Tackle projects and never again get stuck behind a technical roadblock.
Join Now