Solved

OPENROWSET

Posted on 2007-12-06
3
1,049 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tempdb Contention - SQL SERVER 10 37
SQL 2012 Report Builder 3.0 query 2 17
SQL Query 9 25
SQL Server Error: 4060 8 22
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

738 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