You are here: Re: Passing a file path to a SP « MsSQL Server « IT news, forums, messages
Re: Passing a file path to a SP

Posted by Dan Guzman on 04/03/06 15:21

Try enclosing the literal in single-quotes. Specify 2 single-quotes inside
the literal where you have an embedded single-quote:

SET @SQL = 'BULK INSERT tmptable FROM '''+@FileToImport+''''

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Maury" <maurizio.alberti_TOGLI_@gmail.com> wrote in message
news:qS7Yf.64843$A83.1587071@twister1.libero.it...
> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация