Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

inserting data Expand / Collapse
Author
Message
Posted Saturday, November 30, 2013 5:18 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, December 28, 2013 6:04 AM
Points: 107, Visits: 940
Hi
I have two Tables, they are the same, but Table1 has data but Table2 does not have data , both of them have 3 fields, Filed1, Filed 2 and Field 3, Filed Three is "not null".
Now I want to write TSQL for insert data from Table1 in to Table2, but only tha data for Filed1 and Filed 2,
But because Field 3 is defiend Not Null, I can not,
would you please help me?
Post #1518643
Posted Saturday, November 30, 2013 7:26 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 1:31 AM
Points: 1,952, Visits: 2,388
If you dont want to insert data in Field3 then you can remove it...
OR
you can defined DEFAULT value for Field3 so that you will not get error while inserting data from table1 to table2



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1518645
Posted Saturday, November 30, 2013 7:34 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, September 5, 2014 6:19 AM
Points: 147, Visits: 591
Hi,
passing some default values or altering table to add default constraint would be better solution.




Praveen D'sa
MCITP - Database Administrator 2008
http://sqlerrors.wordpress.com
Post #1518648
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse