sql server programming:
Hi all,
Why I can't do the following:
DECLARE @stringConnection as varchar(150)
set @stringConnection= 'Data Source=vrpims\cpims'+';'+'User
ID=sa'+';'+'Password=sa'
select @maxAttendancesVC= max(AEATT_REFNO)
from OPENDATASOURCE( 'SQLOLEDB',
@stringConnection).materprod.dbo.ae_attendances
When I try to execute the above coding the following error message comes out:
Server: Msg 170, Level 15, State 1, Line 25
Line 25: Incorrect syntax near '@stringConnection'.