spacedeveloper
Programmer
Hi everyone,
I must be missing something simple here, but I can't seem to find it. When I try to run this openrowset query I get an
"Incorrect syntax near '+'."
error near the line mentioned. Can someone help me find the problem? Thanks:
Thanks for any help,
Frank
I must be missing something simple here, but I can't seem to find it. When I try to run this openrowset query I get an
"Incorrect syntax near '+'."
error near the line mentioned. Can someone help me find the problem? Thanks:
Code:
declare @PropID varchar(16);
declare @FolioNum int;
set @PropID = 'PID';
set @FolioNum = 17516;
SELECT
a.room
, a.transactionnumber
, LTRIM(RTRIM(CONVERT(VARCHAR(10),a.transactiondate,101))) AS transactiondate
, a.accountnumber
, ISNULL(a.accountdesc, '') AS accountdesc
, CAST(a.credit AS decimal(18, 2)) AS Charges
, CAST(a.debit AS decimal(18, 2)) AS Payments
FROM OPENROWSET
('SQLOLEDB'
, '' + @PropID + '' --<-------*** ERROR MENTIONS THIS LINE *****
; 'userid' ;
'password'
, 'select * from NV.dbo.Database WITH(NOLOCK) WHERE folionumber = ' + cast(@FolioNum as varchar(10)) + ' ORDER BY transactionnumber, transactiondate')
as a
Thanks for any help,
Frank