Solved

OPENROWSET

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now