Solved

What does (0) in a SQL server table represent

Posted on 2014-10-12
6
76 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 10

Expert Comment

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

Assisted Solution

by:HuaMinChen
HuaMinChen earned 250 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Expert Comment

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

Accepted Solution

by:
PortletPaul earned 250 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now