[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

OPENROWSET

Posted on 2007-12-06
3
Medium Priority
?
1,055 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 500 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how the fundamental information of how to create a table.

656 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