Passing a file path to a SP



I'm trying to write a SP that
accept in input a parameter with the name
of a file (with complete path)
but I noticed some problems....

It's right this way? Thanks!

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[BI]
@FileToImport nvarchar(100)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @SQL nvarchar(200)

SET @SQL = "BULK INSERT tmptable FROM '"+@FileToImport+"'"
EXEC (@SQL)
END
.



Relevant Pages

  • Re: help with stored procedure which returns an OUTPUT value
    ... Declare @sColumnName varchar ... what the stored procedure is doing, ... EXEC sp_executesql @sql, @params, @columnname OUTPUT, ...
    (comp.databases.ms-sqlserver)
  • SQL Trace
    ... The following I want from SQL Trace. ... Declare @vchrFileName NVarchar ... Exec SP_Trace_SetStatus @intTraceIdOut,2 ...
    (microsoft.public.sqlserver.server)
  • Dual usage of a openquery in a select statemnet
    ... I need return a table from a stored procedures in MS SQL. ... DECLARE @li_i INTEGER ... EXEC pw.dbo.z_j_test_x 'test2', '100' ...
    (microsoft.public.sqlserver.programming)
  • Re: Access permissions on tables for current user
    ... declare @printline varchar ... IF @dbname is NULL ... SET NOCOUNT OFF ... Check out the PASS Community Summit - Seattle, the largest and only user event entirely dedicated to SQL Server, November 19-22. ...
    (microsoft.public.sqlserver.security)
  • Re: HowTo - Pass in an array of values to SP & sp_executesql
    ... declare @parameters varchar ... exec sp_execute @sql ... Posted using Wimdows.net NntpNews Component - Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching. ...
    (microsoft.public.sqlserver.programming)

Loading