Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

What does (0) in a SQL server table represent

Posted on 2014-10-12
6
Medium Priority
?
85 Views
Last Modified: 2014-10-13
I see for the default value in a table (0)... Whats the difference between a default of 0 and (0) ?
0
Comment
Question by:upobDaPlaya
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:HuaMinChen
ID: 40376222
I think it is having no difference from 0.
0
 
LVL 11

Assisted Solution

by:HuaMinChen
HuaMinChen earned 1000 total points
ID: 40376223
It means both are the same.
0
 

Author Comment

by:upobDaPlaya
ID: 40376235
what do you mean by having no difference from 0 ?  thx
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:HuaMinChen
ID: 40376238
I think you need to bracket 0 in the statement.
0
 
LVL 49

Accepted Solution

by:
PortletPaul earned 1000 total points
ID: 40376473
Absolutely no difference, except the syntax being used

This result:
| ID |      DETAILS | A | B | C | D | E | F | G | H |
|----|--------------|---|---|---|---|---|---|---|---|
|  1 | (one) or one | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

Open in new window

Produce by this DDL:
CREATE TABLE Table1
	(
       id int identity primary key  , details varchar(30)
       
     , [a] float default (0)           , [b] float default 0
     , [c] int default (0)             , [d] int default 0 
     , [e] decimal(12,3)  default (0)  , [f] decimal(12,3) default 0
     , [g] money default (0)           , [h] money default 0
    )
;
	
INSERT INTO Table1
	([details])
VALUES
	('(one) or one')
;

Open in new window

select
*
from table1

Open in new window

http://sqlfiddle.com/#!3/9f048/2
0
 

Author Closing Comment

by:upobDaPlaya
ID: 40379186
Thanks all.  Thanks Porter for the query, that did a great job of demonstrating the issue and answer. Great job !
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question