Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Bulk Insert, OSQL and VMWare!

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-08-10 : 09:49:49
Herb writes "I have gone through your FAQ and was not able to find (my wife states I have trouble finding things even when they are right under my nose) all the pieces. I have created the following procedure (my first). Oh, one last thing, my DB in on a virtual machine and the “C-Drive” of the PC is mapped at the time the VM is created. So here I am trying to learn both VM and SQL Server and I have no one around to ask. Like me, they know Oracle and Informix. So SQL Server Gods can you help to let me know that:
(1) if the procedure is created correctly (system states no syntax error) or could be done better
(2) how to interface it with a table (DataTab) containing table names (TabName) and file names (FileName) where the data for the table is located
(3) execute it to load all the tables (somewhere around 400)

CREATE PROCEDURE MYspDataImport
@FileName varchar(20),
@TabName varchar(8)
AS
DECLARE @LOAD varchar(200)
BEGIN
SET @LOAD = "BULK INSERT TestDB.dbo.['+@TabName+'] FROM '\\tsclient\c\DATA\+@FilePath+' WITH (FIELDTERMINATOR = '|' "
END
EXEC (@LOAD)
GO

I think I will need to use OSQL Utility, but not sure or how to go about it. Any help will be greatly appreciated.
SQL Server 2000
OS: WinServer 2003

PS: Is it true a stored procedure name like MYspDataImport is better than MYsp_Data_Import?

Herb Overstreet
Macon, GA"
   

- Advertisement -