Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What can I do if I want a table name be a parameter of a procedure?

Status
Not open for further replies.

shanghai2004

Programmer
Dec 16, 2004
37
CA
Hi,
I need to use bulk insert to load text files to tables. Since the tables are all in different structures, I want the bulk insert be a procedure, then I can execute the procedure in a loop by assinging different table name and text file name. But SQL does not allow me to take a database object as a parameter of a procedure, now what can I do?
Help please!

Thanks
 
You need to use Dynamic SQL to do this. Or write one procedure for each table.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top