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.
| Author |
Topic |
|
Rigoberto
Starting Member
7 Posts |
Posted - 2011-04-15 : 09:13:05
|
| Hi there,Anybody could help me with a Simple subtract issue:i have this formulaField1 - Filed210 - 5 = 510 - 0 = 0how can you see the result of sample 2 is 0, why?I am running a Sql statement and using some database field and the result when the second field is equal 0 is 0?By the way Field1 is Int and the second one is numeric, could be the problem related with the Field atribute? |
|
|
raghuveer125
Constraint Violating Yak Guru
285 Posts |
Posted - 2011-04-15 : 09:25:59
|
| which version of sql you are usingif possible send some sample data and your queryRaghu' S |
 |
|
|
Rigoberto
Starting Member
7 Posts |
Posted - 2011-04-15 : 09:36:34
|
| SQL SERVER 2008, here is a sample of the sql statementSelect (Field1-Field2) From Table1 |
 |
|
|
raghuveer125
Constraint Violating Yak Guru
285 Posts |
Posted - 2011-04-15 : 09:42:56
|
| Hey what is range of your second field Field2 numeric(,)Raghu' S |
 |
|
|
Rigoberto
Starting Member
7 Posts |
Posted - 2011-04-15 : 09:48:45
|
| hey, Field1(Integer) and Field2(Numeric)Field1 is IntegerField2 is NumericRg |
 |
|
|
raghuveer125
Constraint Violating Yak Guru
285 Posts |
Posted - 2011-04-15 : 09:54:20
|
| Hey try this and tell me what output you getting either same or create table #t(Field1 int, Field2 numeric)insert into #tselect 10,5 union allselect 10,0 union allselect 0,10 select (Field1-Field2)as summ from #tRaghu' S |
 |
|
|
Rigoberto
Starting Member
7 Posts |
Posted - 2011-04-15 : 09:57:43
|
| Thanks Raghu' S, just I have solved my problem, what I did?well I have used the function convert() to convert my Interger field to numeric, jsut it is woking now Thanks a lot all you guys for your help!! |
 |
|
|
|
|
|
|
|