|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, June 10, 2013 6:23 PM
Points: 311,
Visits: 757
|
|
| Is it possible to insert into a 9-byte decimal field (with allow nulls) a value of "+________" , i.e., spaces from 2 to 9th byte. If there is "+0 ", then it gets loaded into the field. Tried loading with all 9-bytes as spaces, even then it gives "Error converting data type nvarchar to numeric". Is there no way to insert spaces or "+ "?
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Sunday, December 19, 2010 10:52 PM
Points: 30,
Visits: 213
|
|
| Can u please make it clear?
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:08 PM
Points: 38,099,
Visits: 30,392
|
|
There is no way. Decimal is a numeric field, it can store numbers only and anything inserted into it is converted to a numeric representation. A space is not a number and cannot be stored in a numeric field.
What are you trying to do? It sounds like formatting, and that's something that typically should be done in queries, not in the data.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, June 10, 2013 6:23 PM
Points: 311,
Visits: 757
|
|
| am trying to load a Text file to a table through SSIS. Usually, the decimal column in text file would have say "+23456789" or "-23456789". Presently, the file has "+--------" i.e. only "+" is existing with the other bytes being white spaces.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:08 PM
Points: 38,099,
Visits: 30,392
|
|
Add a derived column transform in SSIS where you remove the spaces from the data. I think there's a replace function in there. Either replace ' ' with '' or replace ' ' with '0'
The + is not a problem, it's just the spaces.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|