[AccessD] Calling a stored procedure from Access

JWColby jwcolby at colbyconsulting.com
Thu May 3 21:37:53 CDT 2007


OK, let's try this...

The following is what I have stored. 

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER PROCEDURE [dbo].[BulkInsertInfutor]
	-- Add the parameters for the stored procedure here
	@FilName	varchar(255)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
    -- Insert statements for procedure here
	DECLARE @FileSpec varchar(1000)
	set @filespec = 'D:\PSMData\INFUTOR\CSV\'	
	set @filespec = @filespec + @FilName

	DECLARE @SQL varchar(1000)
	set @SQL = 'BULK INSERT Infutor.dbo.infutor	from ' + char(39) +
@filespec + char(39)
	set @SQL = @SQL +' WITH	(FieldTerminator = '
	set @SQL = @SQL + char(39) + '|' + char(39) + ', '
	set @SQL = @SQL + 'ROWTERMINATOR = '
	set @SQL = @SQL + char(39) + '\' + char(39) + 'n)'
	exec @SQL
END 

When I try to do:

Exec BulkInsertInfutor 'NAR_MT1.csv'

I get:

Msg 7202, level 11, State 2, line 22

could not find server 'BULK INSERT INFUTOR' in sys servers.

TIA for all assistance,

John W. Colby
Colby Consulting
www.ColbyConsulting.com




More information about the AccessD mailing list