CREATE procedure gethisData @maxdate int, @mindate int, @fieldname varchar (30) as beginDECLARE @strsql varchar (300) select @ strsql = 'select the date, time,' @ fieldname 'FROM OPENDATASOURCE (' 'SQLOLEDB' '' ',' 'Data Source = .; user ID = sa; password = 123' '' ') .shengli.dbo.hisdata where date> =' str (@Mindate) 'and date < str (@ MaxDate)
EXEC (@strsql) endGo