Home All Groups Group Topic Archive Search About

Can you apply functions while loading data?

Author
4 Aug 2006 12:24 PM
Dwayne King
HI there,

I'm interested in whether or not BCP can apply to functions to data while
loading. 

For example, I am loading source data that has several decimal places (more
than is defined in the table).  Currently (with MSSQL 2000) the decimals are
just truncated to the appropriate number of decimal places.  I want to ROUND
the source data.

Is there an easy way to achieve this?  Short of just widening the table and
rounding afterwards of course :)

Thanks in advance

--
DK

Author
4 Aug 2006 10:19 PM
Erland Sommarskog
Dwayne King (dwayne.k***@cognos.com) writes:
> I'm interested in whether or not BCP can apply to functions to data while
> loading. 
>
> For example, I am loading source data that has several decimal places
> (more than is defined in the table).  Currently (with MSSQL 2000) the
> decimals are just truncated to the appropriate number of decimal places.
>  I want to ROUND the source data.
>
> Is there an easy way to achieve this?  Short of just widening the table
> and rounding afterwards of course :)

No, BCP can't do this.

I would guess that DTS/SSIS are able to do this, but I don't know them.
(DTS is in SQL 2000. SSIS, SQL Server Integration Services, is the
successor in SQL 2005.)



--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button