jeff
jeff

Reputation: 11

Can anyone explain how this constraint functions?

Can anyone explain how this constraint functions and how its affects insertion of records into this table? Running win sql 2k5. Having issue with trying to insert data.

  ALTER TABLE [dbo].[ws_shiptable] ADD  CONSTRAINT [DF_ws_shiptable_ps_processed]  DEFAULT (0) FOR [ps_processed]

Upvotes: 1

Views: 74

Answers (2)

codingbadger
codingbadger

Reputation: 43984

If no value is provided for the column ps_processed then SQL Server will set the value to zero

Upvotes: 0

Rob
Rob

Reputation: 1846

It adds a default value of 0 for column ps_processed. If you do an insert and you don't specify a value for ps_processed, it'll default to 0. What is the issue you are having? Do you get error messages you can post? A default value shouldn't give you trouble, but make sure ps_processed has the right data type. I suspect it'll be a bit field?

Upvotes: 1

Related Questions