Thanks for that Jochem,

What would you suggest as a Staging Table? Does SQL Server have a specific
function for creating this temporary table? Or do I need to build and drop
one myself?

What would you suggest?

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



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

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

Reply via email to