July 21, 2005 at 1:57 am
I need to insert 10 fields into a table that has 200 fields. The problem is I only need to insert into 10 fields but all fields are set to ‘not null’. Is there a way I can do the insert without having to put a space character into all the not null fields?
Thanks
Danny
July 21, 2005 at 2:03 am
Do the not null columns have defaults defined on them?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 21, 2005 at 2:10 am
No they do not have defaults defined on them.
Cheers
Danny
July 21, 2005 at 3:24 am
There's something fishy going on here - presumably the fields were defined as not null for a reason, in which case you should be populating them with sensible data. Or the fields should be changed to allow nulls and your insert will work as you want. Or set them up with defaults as implied by GilaMonster.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 21, 2005 at 3:41 am
An accounting application uses the database I am trying to insert into. The design is terrible. However I can automate data input by inserting data into this particular table. I did not realise what GilaMonster was saying. I think that will work.
Thanks
Danny
July 22, 2005 at 6:41 am
Danny,
If an accounting app is using this table you need to be VERY sure that these fields are not used.
I know some accounting apps are abysmally designed from a normalization point of view. They are often written by accountants, not trained programmers/DBAs. However, accounting systems (automated or manual) by necessity have realtionships that cannot be ignored if you want to produce accurate books-of-record. I once heard one of our accounting directors complain that he couldn't make a one-sided journal entry.
I don't want to belabor the point, but tinkering with or subverting the system that produces a company's financial statements and is used in filing tax reports/returns is an excellent way to begin the search for a new job or a good laywer.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply