Also guys,

When trying to switch out that bulk insert with a parameter I get the
following error when running the SQL that should create the procedure.

BULK INSERT DeviceStaging
FROM @location

Msg 102, Level 15, State 1, Procedure usp_CommitDeviceLog, Line 4
Incorrect syntax near '@location'.

Any ideas?

Thanks,

Rob

-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED] 
Sent: 23 April 2007 09:34
To: CF-Talk
Subject: Re: Stored Proc Help

Robert Rawlins - Think Blue wrote:
> 
> GF:34:00:3F:FD, 6, 1, 2007-01-01 13:00:00, 1
> GF:34:00:3F:FD, 6, 2, 2007-01-01 13:01:00, 1
> GF:34:00:3F:FD, 6, 1, 2007-01-01 13:04:00, 1
> GF:34:00:3F:FD, 6, 4, 2007-01-01 13:08:00, 1

> create procedure usp_Something AS
> BULK INSERT YourStagingTable
> FROM 'c:\YourInputFile.txt'
> 
> INSERT INTO TableWithMacAddresses
> SELECT MacAddress, Port
> FROM YourStagingTable
> WHERE MaxAddress NOT IN (SELECT MacAddress FROM TableWithMacAddresses)

You really want a DISTINCT here.


> INSERT INTO TableWithLoggingData
> SELECT {Your Columns}
> FROM YourStagingTable
> 
> GO

INSERT INTO TableWithLoggingData (x, y, z)
SELECT TWMA.PK, YST.y, YST.z
FROM YourStagingTable YST INNER JOIN TableWithMacAddresses TWMA ON 
YST.MacAddress = TWMA.MacAddress

Jochem



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276001
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to