473,609 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_IDENTIFI ER ON
go

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

SET @SQL = "BULK INSERT tmptable FROM '"+@FileToImpor t+"'"
EXEC (@SQL)
END
Apr 3 '06 #1
2 1474
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 '''+@FileToImpo rt+''''

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Maury" <ma************ *********@gmail .com> wrote in message
news:qS******** *************@t wister1.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_IDENTIFI ER ON
go

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

SET @SQL = "BULK INSERT tmptable FROM '"+@FileToImpor t+"'"
EXEC (@SQL)
END

Apr 3 '06 #2
Dan Guzman ha scritto:
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 '''+@FileToImpo rt+''''

IT'S OK!!!!
Thank you very very much.....
(and sorry I'm a newbie in SQL Server)
Apr 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
3138
by: Antoni | last post by:
Hello, I wondered if anyone could offer some guidance over my php script. I was hoping the example would allow the user to click the submit buttons and the item number increment. And when the user clicks, the my basket icon the items.php scripts starts and the variables from the current script are passed to this. I tried to display the variables as the items are incremented, though
1
2816
by: Lewis Sellers | last post by:
I have a custom JSSESocketFactory class that can take a PKCS12 certificate and password and use it to talk through axis to a secure web service. That works.... The problem is it needs to work on a shared hosting environment where each customer will have thier own certificates, the certificate is used used to verify their identity. I've been staring at the JSSE but am at somewhat of a loss as how to pass the cert location/password TO the...
10
2533
by: Rigga | last post by:
Hi, Ok first please bear with me as I am a total Python n00b.. Can anyone explain why this does not like me using % FileLoc in the os.system call??? #!/usr/bin/python import sys import os
7
2846
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID); xmlItems.TransformArgumentList = xsltArgList;
5
4066
by: Matthew Thompson | last post by:
I have as issue I am finding hard to research. I use a stored proecdure in SQL 2000 to provide search capability for our database of news stories and articles. Being an international magazine publisher we use foreign characters extensively. When searching for words (I am using Full Text Indexing and using the CONTAINSTABLE method) with accented characters such as Møller (Second character is Alt+0248) the form receives back Møller
5
8611
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file". Same file path containing special characters works fine in one machine, but doesn't work in other. I am using following API function to get short file path. Declare Auto Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath As
1
1702
by: IMRAN | last post by:
I have created a component which parses some flat files and stores in Sql database. Now I want to move that COM object to database server. Now the scenario will be like this : 1) ASP page will get the file from the client 2) Then ASP page will call the stored procedure alongwith the file data as parameter.
2
1707
by: Harmony504 | last post by:
I am passing a form field in JavaScript to a PHP function. The problem is when the parameter gets inside the PHP function the value is set to 1 when it should be a relative path to a file. setup_config.php: <script language="javascript"> function install(){ ... Install.ExecuteDBScript(document.getElementById('path').value, document.getElementById('self-serve').checked, function (result) { alert("result = " + result);
3
3450
by: NobodyImportant | last post by:
Hello everyone! I admit up front that I am new at this and have very little knowledge of JavaScript, but we have an asp web form that allows for the manipulation of letters our company regularly uses. In the administration of this web utility, a user can update the file path of a Word document. Here is the relevant asp code for the admin page: while not rst.EOF %> <input type=hidden name=letterid value=<%=rst("ql_guid")%>>...
2
4302
by: Peted | last post by:
Hi i have a circumstance where a user unzips a file, with a certain layer of directories to get to a textfile. So in any directory on the HDD they may end up with something like dir1/dir2/dir3/dir4/dir5/file.txt
0
8053
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8557
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8380
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5504
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1638
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.