?
Solved

OPENROWSET

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

752 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