Solved

OPENROWSET

Posted on 2007-12-06
3
1,050 Views
Last Modified: 2008-07-29
hi,

I am using this:

SQLstr = "INSERT INTO UserUploadComments (DealName,      DealNameID,      ServicerID,      ServicerLoanNumber, CommentDate, Comments) SELECT '" & trim(SESSION("DealName")) & "' as DealName, " & trim(SESSION("Deal")) & ", 0, ServicerLoanNumber, CommentDate, Comments FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=\\Comments\19\aaa.xls' ,'SELECT ServicerLoanNumber, CommentDate, Comments FROM [sheet1$]') "

is there a way to set Database part as variable?  (I am running this from ASP )thanks
0
Comment
Question by:mcrmg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
imrancs earned 125 total points
ID: 20419114
Are you looking for this ?

Dim strDatabase

strDatabase = "\\Comments\19\aaa.xls"

SQLstr = "INSERT INTO UserUploadComments (DealName,      DealNameID,      ServicerID,      ServicerLoanNumber, CommentDate, Comments) SELECT '" & trim(SESSION("DealName")) & "' as DealName, " & trim(SESSION("Deal")) & ", 0, ServicerLoanNumber, CommentDate, Comments FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=" & strDatabase  &"' ,'SELECT ServicerLoanNumber, CommentDate, Comments FROM [sheet1$]') "

Imran
0
 

Author Comment

by:mcrmg
ID: 20419160
yes...thank you
0
 
LVL 10

Expert Comment

by:imrancs
ID: 20419808
You are welcome!

Imran
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question