Solved

importing numbers from access into sql with different format

Posted on 2011-03-09
4
308 Views
Last Modified: 2012-06-22
I am importing a column from access to sql 2005 but the numbers in the column are formatted differently:  e.g.
2000
0.50
2.8
22.55
I would like all to have decimal 2 places.  the sql column is money format.  thanks
0
Comment
Question by:bar0822
4 Comments
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 84 total points
ID: 35090715
You can make the column a decimal(18,2) format or you can just cast it when you use it.
Select cast(numbercolumn as decimal(18,2)) from table

If you do that you could store it as a varchar or whatever.
0
 
LVL 9

Assisted Solution

by:kaminda
kaminda earned 83 total points
ID: 35091117
I would suggest you to import data to SQL Server's varchar column with the required length. And then covert it to money within SQL Server by casting it. This way you wont loose any data due to formating (At least it is minimal)
0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 83 total points
ID: 35093276
Leave the numbers "as is" and format them to your liking when displayed.

/gustav
0
 

Author Comment

by:bar0822
ID: 35097666
I imported as is and imported into money column and now have 4 zeros after decimal point but will leave as is unless they want it changed.  I'll use a cast in select.  thanks for the replies.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

821 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