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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to get system date automatically in the column

Author  Topic 

arthiasha
Starting Member

40 Posts

Posted - 2012-11-08 : 01:57:54

Hi experts,

I have a table called branch with columns
branch_code
branch_name
branch_desc
modified_by
modified_date

Here i have data for the 1st three columns and the rest 2 fields 'modified_by' and 'modified_date' has to get values automatically from the system...
I did a bulk insert to get the data into those 3 columns but it is expecting 'modified_by' and 'modified_date' fields.
How do i give it separately? the values in those last 2 fields should be given as 'system' and GETDATE()

Please help me with ur scripts

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-11-08 : 02:21:29
Have you designed your table with DEFAULT constraint?

Check this link (Keep Nulls or UseDefault Values During Bulk Import)
http://msdn.microsoft.com/en-us/library/ms187887.aspx

--
Chandu
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2012-11-08 : 06:57:33
as bandi mentioned you need apply default values to the two columns.
Go to Top of Page
   

- Advertisement -