I'm using a bulk insert
<code>
CREATE PROCEDURE importcsv
@user_site_id varchar(100),
@filename varchar(255),
@tablename varchar(25),
@template varchar(255)
as
declare @dynINSERT varchar(300)
declare @dynDELETE varchar(300)
declare @dynUPDATE varchar(300)
select @dynDELETE = ' DELETE FROM '+@tablename
select @dynINSERT = ' BULK INSERT '+@tablename+'
FROM '''+@filename+'''
WITH( FIELDTERMINATOR = ''|'' ,
ROWTERMINATOR = ''\r\n'' ,
FIRSTROW=2,
FORMATFILE='''+@template +''' )'
select @dynUPDATE = ' UPDATE '+@tablename+'
SET call_site_id = '''+@user_site_id+'''
WHERE call_site_id = ''unknown'''
print @dynDELETE
exec(@dynDELETE)
print @dynINSERT
exec(@dynINSERT)
print @dynUPDATE
exec(@dynUPDATE)
</code>
> -----Original Message-----
> From: Dean H. Saxe [mailto:[EMAIL PROTECTED]]
> Sent: 25 September 2001 14:17
> To: SQL
> Subject: RE: Data type conversion
>
>
> How are you inserting your data? Lets see the SQL...
>
> -dhs
>
> At 02:08 PM 9/25/01 +0100, you wrote:
> >I am now getting negative numbers ?
> >
> > > -----Original Message-----
> > > From: Dean H. Saxe [mailto:[EMAIL PROTECTED]]
> > > Sent: 25 September 2001 13:31
> > > To: SQL
> > > Subject: Re: Data type conversion
> > >
> > >
> > > Use a numeric datatype. In Oracle, number(7,6), SQL server
> > > is something
> > > similar. The first digit inside the parenthesis is the number of
> > > significant digits, the second number is the number of digits
> > > after the
> > > decimal. If you data is >= 0 and <= 1 this will work,
> > > assuming you only
> > > need six decimals.
> > >
> > > -dhs
> > >
> > > At 12:34 PM 9/25/01 +0100, you wrote:
> > > >I am bulk inserting a file into my database that contains
> > > the column 'cost'
> > > >
> > > >The column has the following values:
> > > >0.113333
> > > >0.0105
> > > >0.02178
> > > >0.040333
> > > >0.028022
> > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists