Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello,I have one temp table and two production tables. I'm trying to insert new records into each table from the temp table. There are only a few fields in the temp table I need which will insert into each table. I know how to fetch into a cursor and produce a final resultset (in this case insert), but the challenge I face here is that there are not null fields in each table that need to have a value. So, my question is, do I have to add all the not null fields to my temp table so the cursor has the same number of variables (values to table fields), or can I just hard code the values for the not null fields in the select statements, knowing that the nullable and identity fields will take care of themselves on the insert. In other words, the only fields I would need to be concerned with are the 5 fields from the temp table I'm fetching into the cursor, then hard coding values in the select statements for the not nullable fields and letting the nullable and identity seed increment fields do their thing. Is this a correct assumption? Or am I way off? In any case, if anyone could share their expertise on this matter it would be most greatly appreciated.Thank you for your time,Dennis