I had a field called camp is integer data type. I just found it had a default value, but the value is " (0) ", not just " 0 ". It should be 0, right? why it use (0), are they same? thanks.I had a field called camp is integer data type. I just found it had a default value, but the value is " (0) ", not just " 0 ". It should be 0, right? why it use (0), are they same? thanks.
And if you insert a new record with no value in the field then select that record what is the value?
Sql stores the default and displays it that way No biggy|||I don't understand what you mean. If no value, i would like to have value 0, but why it use (0)?|||It's just part of the syntax
USE Northwind
GO
SET NOCOUNT ON
CREATE TABLE myTable99(
Col1 int IDENTITY(1,1) NOT NULL PRIMARY KEY
, Col2 int NOT NULL DEFAULT(0)
, Col3 char(1)
)
GO
INSERT INTO myTable99(Col3) SELECT 'x'
SELECT * FROM myTable99
INSERT INTO myTable99(Col2,Col3) SELECT 1,'y'
SELECT * FROM myTable99
GO
SET NOCOUNT OFF
DROP TABLE myTable99
GO
And stop using EM, you won't learn much using it...Do you have Books Online?|||If using query Analayzer, we have to use (0). If i set default value in the Enterprise Manager, i just open the table in design view, and then just type 0 in the default, not type (0) in the default, is that correct? I don't have book online, can i check online? Thanks|||Thanks, i got it, it is just syntax. Thanks all.|||I did set the default value 0 on the check box fileld, but when i check the data in the back end, it still has null value, why? Also in the front end, i set the default value to 0, it still didn't work, always give you null value if you didn't check it. But if i check it and then uncheck it. It will give you 0 value. How can i do so the if you didn't touch the check box, it will give you 0 value automatically? Thanks.|||If it was NULL BEFORE you set the default it will reamin NULL
You need to do an update statement.
Stop using EM
If you have Enterprise Manager, the you most likely have Books Online as well...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment