I am still at the same point.
What should i change to make this code work? Thanks
The error i get is:
Cannot use the OUTPUT option when passing a constant to a stored procedure
this is part of a stored procedure
declare sql nvarchar(200), maxdate datetime
SET @sql = N'SELECT @m = MAX(date) FROM ' + @link_server + '.database1.dbo.table1
EXEC sp_executesql @sql, N'@m datetime OUTPUT', MaxDate OUTPUT
print ('max= ' + cast (@MaxDate as varchar (40)) )
What should i change to make this code work? Thanks
The error i get is:
Cannot use the OUTPUT option when passing a constant to a stored procedure
this is part of a stored procedure
declare sql nvarchar(200), maxdate datetime
SET @sql = N'SELECT @m = MAX(date) FROM ' + @link_server + '.database1.dbo.table1
EXEC sp_executesql @sql, N'@m datetime OUTPUT', MaxDate OUTPUT
print ('max= ' + cast (@MaxDate as varchar (40)) )